Search found 562 matches

by mnf
Wed Apr 08, 2020 6:53 pm
Forum: Flowcode V8
Topic: MFRC522 multible card/tag
Replies: 12
Views: 223

Re: MFRC522 multible card/tag

Okay - and now up and running and checking cards... You'll need to use UART and setup some cards to suit the UIDs you have (I had three cards - and setup two - change the value of the constant Number_of_Cards if you have more) It displays the UID of the Card read and then then name attached (or 'int...
by mnf
Wed Apr 08, 2020 5:36 pm
Forum: Flowcode V8
Topic: MFRC522 multible card/tag
Replies: 12
Views: 223

Re: MFRC522 multible card/tag

There seems to be something amiss with the v8 RFID component.... Correction - then suddenly it worked.... I fear this could be related to the SPI on Arduino not always working correctly. I didn't change the code - I added a macro (actually an attempt to use the v7 RFID Initialise) and recompiled - n...
by mnf
Wed Apr 08, 2020 11:53 am
Forum: Flowcode V8
Topic: MFRC522 multible card/tag
Replies: 12
Views: 223

Re: MFRC522 multible card/tag

Okay - I'll try. I did a bit of tidying - back to 4 byte UID and use CompareUID to match to current UID from valid card table... But - I can't actually get my card reader to register a card using FC... IsNewCardPresent always returns 0 :-( The hardware seems to work AOK (I've tested it using the Ard...
by mnf
Mon Apr 06, 2020 10:51 pm
Forum: Flowcode V8
Topic: MFRC522 multible card/tag
Replies: 12
Views: 223

Re: MFRC522 multible card/tag

Looks very good. I like the case for the display too. i can only dream of having a powered door opener on our garage here - last few days have been so windy I haven't been able to open them... So a simple example for multiple cards. It works AOK in simulation - I've disabled the reader icons and (im...
by mnf
Mon Apr 06, 2020 4:48 pm
Forum: Flowcode V7
Topic: Counter not working in 16 bit
Replies: 6
Views: 80

Re: Counter not working in 16 bit

Something odd though -
since a left shift (<<8) is the 'same' as multiplying by 256.

Type error possibly - using a byte value might cause problems somewhere?

Martin
by mnf
Mon Apr 06, 2020 8:51 am
Forum: Flowcode V8
Topic: MFRC522 multible card/tag
Replies: 12
Views: 223

Re: MFRC522 multible card/tag

Hi Jorgen, No problem I'll do an example this evening... To muddy the water slightly - how about saving valid keys and names in the eeprom (or elewhere?) - this would allow you to update the list of allowed cards without reprogramming the device (however adding the names might be trickier?). Glad to...
by mnf
Sun Apr 05, 2020 10:16 pm
Forum: Flowcode V8
Topic: MFRC522 multible card/tag
Replies: 12
Views: 223

Re: MFRC522 multible card/tag

Hi Jorgen, How about using an array of long (unsigned) ints (conveniently the card ID is 4 bytes or 32 bits as per a long int) - Then it is an easy task to look through the 'ids' using a loop - and possibly have a second array of names to pull up the user 'name' So, say with have 10 ids and a corres...
by mnf
Sun Apr 05, 2020 9:47 pm
Forum: Flowcode V8
Topic: Non flowcode subject
Replies: 4
Views: 66

Re: Non flowcode subject

Hi Jan,

Yes, sorry to hear about the health issues. Enjoy getting back into Flowcode - a useful diversion in these difficult times. Any questions please post and I'm sure someone here will try and help!

Best wishes

Martin
by mnf
Sun Apr 05, 2020 10:13 am
Forum: General Programming
Topic: Embedded system ventilator
Replies: 14
Views: 172

Re: Embedded system ventilator

For home use - cpap machines are used and available to treat sleep apnea and provide air at 3-20hPa (for example) - note that I suspect oxygen would be added in a hospital setting. Home oxygen usually is regulated to 2 (or occasionally 4) l/min - from a cylinder or concentrator. Nebulized drugs woul...
by mnf
Sun Apr 05, 2020 5:47 am
Forum: General Programming
Topic: Embedded system ventilator
Replies: 14
Views: 172

Re: Embedded system ventilator

Yes, difficult times. I work as a pharmacist so have been extremely busy - panic 'buying' hasn't just applied to food. I'd say a ventilator isn't a good idea - you need to be heavily sedated - not something to try at home. Or encourage others to try. A team (Italian I think) has come up with an auto...
by mnf
Mon Mar 30, 2020 2:32 pm
Forum: General Programming
Topic: FLOAT to INT and back again.
Replies: 33
Views: 1185

Re: FLOAT to INT and back again.

Yes,
Use FCL_ as the prefix to the uppercase name ( instead of FCV_)

Martin
by mnf
Wed Mar 11, 2020 10:50 pm
Forum: Programming Tips & Tricks
Topic: WS2812 LED Flexible 32 x 8 grid
Replies: 15
Views: 2720

Re: WS2812 LED Flexible 32 x 8 grid

Another use for a WS2812 chip... Not really much Flowcode here - but hopefully someone will find the idea useful (hopefully some FC to come later :-) ) - wanted to create a simple puzzle game using illuminated push buttons that can change colour... However apart from some three colour buttons (with ...
by mnf
Mon Mar 02, 2020 10:09 am
Forum: General Programming
Topic: storing data in memory
Replies: 6
Views: 328

Re: storing data in memory

Writes are not 'atomic' (to use a database analogy) - however, if the data is only written occasionally the risk of corruption is be pretty small.. For example 'ignition turned off' (5s capacitor power available) - write data. Read on startup... It depends how 'mission critical' the data is too? Mar...
by mnf
Mon Mar 02, 2020 8:35 am
Forum: General Programming
Topic: storing data in memory
Replies: 6
Views: 328

Re: storing data in memory

Also take a look at using the eeprom in the mcu. You can store up to 1024 bytes on the atmega328 and these values survive power 'cuts '. The memory has a limited number of write cycles (100000)- so don't write the value too often and always read the value and check if the new value is different befo...
by mnf
Sun Feb 09, 2020 5:41 pm
Forum: Flowcode V8
Topic: Atmega8 Series Sleep mode and Watchdog Timers
Replies: 12
Views: 719

Re: Atmega8 Series Sleep mode and Watchdog Timers

Hi Sadik, I created a simple wdt example - note I use an Arduino Nano (and flash the inbuilt led on B5) I use a custom interrupt handler to set up the wdt and a handler (an empty macro) - not sure on the code to disable the interrupt, so have left this as an exercise... Try on Atmega8 - hopefully wi...
by mnf
Sun Feb 09, 2020 5:40 am
Forum: General Programming
Topic: FLOAT to INT and back again.
Replies: 33
Views: 1185

Re: FLOAT to INT and back again.

You can just assign the value.. .f32 = .f64 should work although you might need a cast. In a C block - FCL_F32 = (float) FCL_F64; However - if FC is defining a float as 64 bit you might struggle with your definitions? Pulling the exponent and mantissa from the byte values would by tricky. See https:...
by mnf
Sat Feb 08, 2020 10:39 pm
Forum: General Programming
Topic: FLOAT to INT and back again.
Replies: 33
Views: 1185

Re: FLOAT to INT and back again.

So - you want to convert the value to a 32bit integer (rather than a 32bit float)? What range of values are you working with and how many points of accuracy do you need? Taking the byte 'values' of the fp number isn't the way to go here (it would be possible - but difficult) Could you - for example ...
by mnf
Sat Feb 08, 2020 8:27 pm
Forum: General Programming
Topic: FLOAT to INT and back again.
Replies: 33
Views: 1185

Re: FLOAT to INT and back again.

If they are 64 bit then change byte array to 8 bytes (and the loop in FloatToByte)

If the values are 32 bit the last 4 bytes will be junk...

Martin
by mnf
Sat Feb 08, 2020 8:11 pm
Forum: General Programming
Topic: FLOAT to INT and back again.
Replies: 33
Views: 1185

Re: FLOAT to INT and back again.

Hi Kisen,

Try this - works AOK on Arduino and hopefully on ARM too....

Note the reversal of the bytes in FloatToByte...

float_to_byte.fcfx
(12.39 KiB) Downloaded 14 times


Note - if the floats are 64bit) - then extend the byte array to 8 bytes. If it is only 32bit then the last 4 bytes may be 'random' data

Martin
by mnf
Mon Feb 03, 2020 8:00 pm
Forum: Flowcode V8
Topic: Atmega8 Series Sleep mode and Watchdog Timers
Replies: 12
Views: 719

Re: Atmega8 Series Sleep mode OK, So how do I wake up this processor?

I had a brief play with your code - and compiling for ATMega8 - gave a hex too large (by 3k!) using FC8 I fixed this by changing the optimisation of the compiler from the FC default to the maximum for gcc. (This requires editing avra.bat (in C:\Program Files (x86)\Flowcode\Common\Compilers\avr\batch...
by mnf
Mon Feb 03, 2020 9:59 am
Forum: Flowcode V8
Topic: Atmega8 Series Sleep mode and Watchdog Timers
Replies: 12
Views: 719

Re: Atmega8 Series Sleep mode OK, So how do I wake up this processor?

Hi Sadik, Will take a peek after work (though, with the helpful folk on the forum, you may have an answer by then :) )... In the meantime - can the RFID reader generate an interrupt on card present? If so - could this wake the processor. (A a quick glance at the datasheet didn't reveal one - generat...
by mnf
Mon Feb 03, 2020 2:41 am
Forum: Flowcode V8
Topic: Atmega8 Series Sleep mode and Watchdog Timers
Replies: 12
Views: 719

Re: Atmega8 Series Sleep mode OK, So how do I wake up this processor?

Hi Sadik,

What sleep level are you using? Wake can be on interrupt (say rx or WDT or external) - can you post a snippet of code?

Martin
by mnf
Sun Feb 02, 2020 11:44 pm
Forum: Flowcode V8
Topic: Atmega8 Series Sleep mode and Watchdog Timers
Replies: 12
Views: 719

Re: Atmega8 Series Sleep mode

Hi Sadik,

You'll need a (in a C block or Supplementary code)

Code: Select all

#include <avr/sleep.h>


and then use

Code: Select all

sleep_enable();
sei();
sleep_cpu();


See https://www.microchip.com/webdoc/AVRLibcReferenceManual/group__avr__sleep.html

Martin
by mnf
Tue Jan 28, 2020 9:42 pm
Forum: General Programming
Topic: FLOAT to INT and back again.
Replies: 33
Views: 1185

Re: FLOAT to INT and back again.

See this thread viewtopic.php?f=7&t=21470&hilit=float where a different approach is used (taking the address of the number and writing/reading the value)

But, please, can you post your code that is not working?

Martin
by mnf
Mon Jan 27, 2020 8:26 pm
Forum: Flowcode V8
Topic: Not able to program a MEGA 2560 R3
Replies: 6
Views: 402

Re: Not able to program a MEGA 2560 R3

See https://www.matrixtsl.com/flowcode/buy/5.php (you will need to login) - the Arduino pack contains what you need.. If you already own it - in FC - Help -> Manage Licences -> My Licences. Enter your Matrix username (not forum name) and click Activate. It will prompt for password and should reinsta...