Search found 491 matches

by mnf
Wed Nov 20, 2019 11:31 pm
Forum: C and ASM Programming
Topic: C-code
Replies: 25
Views: 757

Re: C-code

Hi, Glad to hear it's receiving ok! Can you post your code that's giving the errors? I used m ((msg) as an array to receive the data and x (& y) as data to be extracted. Both were declared as local variables ( hence the '.' at the start) - it's good practice to keep a minimum number of globals t...
by mnf
Tue Nov 19, 2019 9:06 am
Forum: C and ASM Programming
Topic: C-code
Replies: 25
Views: 757

Re: C-code

The receiving end displays data to uart.. Getting data out - bytes 5 and 6. Use ( in a calculation block) .x = .m[4] .y = .m[5] Note that array indexes start at 0. If the data is a word then .x = (.m[4] << 8) + .m[5] where x is a 16 bit variable - and assuming that data is sent high byte then low (t...
by mnf
Sun Nov 17, 2019 9:43 pm
Forum: C and ASM Programming
Topic: C-code
Replies: 25
Views: 757

Re: C-code

- And it works !!! So one Arduino acting as a J1850 sender and one as receiver.... Note that the transmit and receive programs haven't been merged (so use Send_msg from transmit and Receive.... you get the idea.) And because it should always be done so: 'Hello World' (rotating here to keep the scope...
by mnf
Sun Nov 17, 2019 3:07 pm
Forum: C and ASM Programming
Topic: C-code
Replies: 25
Views: 757

Re: C-code

Now done send too.

Output looks reasonable on the oscilloscope - but receive not happy.

I'll post when it works!

Oops - defined tcnt1_buf as a byte rather than 16 bit. Now receives something reliably (ie the same every time) just not the same as the message sent :(

Martin
by mnf
Sun Nov 17, 2019 12:28 pm
Forum: Flowcode V8
Topic: RPI and long distance radio
Replies: 8
Views: 145

Re: RPI and long distance radio

For built up areas, how about a GSM module and send text messages.

Could get pricey (story about eagle flying to Iran and racking up roaming charges.) - but with the right SIM card it could work?

Martin
by mnf
Sat Nov 16, 2019 8:52 pm
Forum: C and ASM Programming
Topic: C-code
Replies: 25
Views: 757

Re: C-code

Okay - created a receive message macro. If you could try it with your hardware - there is a 50:50 chance it will work (it either will work or it won't :) ) I can't test it until I do a Send macro :( and second nano can pretend. I've put a very simple test into main - tries to receive a message and o...
by mnf
Fri Nov 15, 2019 8:59 pm
Forum: C and ASM Programming
Topic: C-code
Replies: 25
Views: 757

Re: C-code

I converted the CRC routine (probably should have left this as C - although it is only short - going for the easy targets first!) I used a string as the message to CRC - and really should have used an array of bytes (although is string is just an array of bytes :-) ) - FC doesn't let you change the ...
by mnf
Thu Nov 14, 2019 9:26 pm
Forum: C and ASM Programming
Topic: C-code
Replies: 25
Views: 757

Re: C-code

Ok - a simple 'proof of concept' test (after a very long day at work :-( ) A simple circuit - two arduino nanos - ground and 5v connected (I only found one USB lead :-( ) and D3 connected to D3 (signal) One nano outputting 200us pulses (as per above but at a 1s interval) and one receiving - flashing...
by mnf
Thu Nov 14, 2019 12:05 am
Forum: C and ASM Programming
Topic: C-code
Replies: 25
Views: 757

Re: C-code

Yes, we can use this to measure a pulse, we start the timer when the pin is 'set' and then record the time when it changes state again - then compare this with the low and high bound of the expected pulse length. We could probably also use the GetRawCount or GetMicroSecs - from the timer component -...
by mnf
Wed Nov 13, 2019 12:30 pm
Forum: C and ASM Programming
Topic: C-code
Replies: 25
Views: 757

Re: C-code

- a bit more playing and I converted the C code (above) using Timer1.. - Little conversion was necessary -just added to supplementary code. This generates a steady 202us (probably within the realms of crystal errors on Arduinos?) pulse - and can be used as a starting point for a conversion. timer_te...
by mnf
Wed Nov 13, 2019 11:34 am
Forum: C and ASM Programming
Topic: C-code
Replies: 25
Views: 757

Re: C-code

I took a quick look at using a timer component - and it's opened a bit of a can of worms... So - in the first instance I try to pulse a pin a 200us intervals using a timer and a delay. (Note that this is effectively how the C code you posted measures the length of SOF pulses.) - and there seems to b...
by mnf
Mon Nov 11, 2019 10:05 am
Forum: Bug Reports
Topic: AP102 LEDs
Replies: 4
Views: 131

Re: AP102 LEDs

Not quite a complete fix - needs the bit-bang alternative too! Hopefully easy for Ben & co to incorporate.

I've been trying (and failing) to get them working with an ATTiny85...

Martin
by mnf
Sat Nov 09, 2019 8:25 pm
Forum: Bug Reports
Topic: AP102 LEDs
Replies: 4
Views: 131

Re: AP102 LEDs

The cause of this is the lack of an end frame in Refresh()..

From the data sheet:
data.PNG
data.PNG (125.43 KiB) Viewed 107 times


So adding my own refresh macro which adds an end frame:
MyRefresh.JPG
MyRefresh.JPG (17.82 KiB) Viewed 107 times


- and the correct number of LEDs now illuminated..

Martin
by mnf
Fri Nov 08, 2019 9:51 pm
Forum: Bug Reports
Topic: AP102 LEDs
Replies: 4
Views: 131

AP102 LEDs

Just noticed a small bug in the Arduino (I've tested) implementation of AP102C component. A simple single strand of LEDs connected to SPI (hardware) works AOK - if you remember to set B2 to output. - But I noticed that one LED was not lit. Rather than counting to 60 (ran out of fingers) - I reset th...
by mnf
Fri Nov 08, 2019 8:53 am
Forum: C and ASM Programming
Topic: C-code
Replies: 25
Views: 757

Re: C-code

Hi, Yes, sorry i didn't mean to criticise - I'd hesitated to post when you first asked the question. So, yes - I program because it is interesting and fun! Flow code is good because it has a friendly (honestly, we try) forum - and, speaking for myself, I enjoy chatting and thinking about programming...
by mnf
Wed Nov 06, 2019 6:55 pm
Forum: C and ASM Programming
Topic: C-code
Replies: 25
Views: 757

Re: C-code

Hi Dutch, I had a little play with this after your previous post.. Can I suggest that you investigate arrays - rather than saving to 8 individual variables. It will make your code much easier to follow (and shorter to enter too - always good) I'd suggest using a property for the pins too - will make...
by mnf
Fri Nov 01, 2019 11:17 pm
Forum: Flowcode V8
Topic: programming atmega 328
Replies: 2
Views: 145

Re: programming atmega 328

I don't think there is a problem if you have an external clock and don't rely on any of the hardware.... See https://www.arduino.cc/en/Tutorial/ArduinoToBreadboard - of course there is the question of what to do with the Arduino afterwards - put another chip in it - and the associated problems of in...
by mnf
Fri Nov 01, 2019 12:40 am
Forum: Programming Tips & Tricks
Topic: Raspberry Pi system command.
Replies: 1
Views: 1179

Re: Raspberry Pi system command.

Happy Halloween to you all.. A Flowcode Haunted House Project.... This was supposed to have been a weekend project - but building the house itself took a lot of time. It is from Matt Bergstrom's 'Cut and Assemble' haunted house book - and the result is a nicely detailed model. There is plenty of roo...
by mnf
Mon Oct 28, 2019 11:51 pm
Forum: Bug Reports
Topic: Arduino Bugs
Replies: 0
Views: 122

Arduino Bugs

Some fairly minor bugs (on the Arduino platform (only?)) 1) Create a property aPin as a single analog pin. It a calculation box - aPin = 1 This gives a cannot assign to non-variable on left of equals error. (Note that the analog pins can be used as GPIO on Arduino platform - so should be possible to...
by mnf
Wed Oct 23, 2019 9:03 am
Forum: Bug Reports
Topic: PIC32MZ + WS2812 Not Working
Replies: 49
Views: 1301

Re: PIC32MZ + WS2812 Not Working

If I might interrupt with a couple of suggestions: (based on some Arduino code I did in v7 - I rewrote several of the ws2812 macros...) 1) Adding a SetPixelBrightness macro for a specified pixel might allow a chain of LEDs to be used? (An array of scaling factors could be used for 'ease' of use and ...
by mnf
Sun Oct 20, 2019 12:00 pm
Forum: Flowcode V8
Topic: I2C GLCD start problem
Replies: 10
Views: 382

Re: I2C GLCD start problem

Flow code uses th address shifted left one bit (x2) with bit 0 as r/w

Both systems seem to be in widespread use - but it is a bit confusing - though I think the unshifted form seems more common.

Martin
by mnf
Sat Oct 19, 2019 4:55 pm
Forum: Flowcode V8
Topic: I2C GLCD start problem
Replies: 10
Views: 382

Re: I2C GLCD start problem

Hi Jan, Looks like the MCU you are using doesn't have sufficient RAM (1024 bytes on the PIC 16LF1847) for the display buffer. FC is trying to allocate a buffer of 8 x 128 bytes for the display memory (1k) and there are several other variables (currentX etc) - you could use one of the 32x128 displays...
by mnf
Fri Oct 18, 2019 10:58 pm
Forum: Bug reports
Topic: Missing Toolbar
Replies: 2
Views: 169

Re: Missing Toolbar

There is a 'restore' option under the 'Window' menu.

Alt W should display it

Martin
by mnf
Thu Oct 17, 2019 9:19 pm
Forum: Programming Tips & Tricks
Topic: Printing Hexadecimal Numbers onto an LCD
Replies: 3
Views: 4565

Re: Printing Hexadecimal Numbers onto an LCD

Use the NumberToHex$ function - see post in other thread....
by mnf
Thu Oct 17, 2019 9:18 pm
Forum: General Programming
Topic: Howto :- 32bit addition from 4 Registers
Replies: 6
Views: 399

Re: Howto :- 32bit addition from 4 Registers

You can just view the variable(s) in the simulation debugger (tick the display as hex box)- or you can use NumberToHex$ to convert to a string... Here: demo.fcfx I convert to a string and then display on a lcd_16x2 - this displays the result in the simulated display correctly (but that is one awful ...