Search found 1013 matches
- Sat Jul 24, 2021 3:33 pm
- Forum: Flowcode V8
- Topic: Float to Integer with 2 Decimal points
- Replies: 3
- Views: 1408
Re: Float to Integer with 2 Decimal points
Hi Abhi, It's not easy to do a straight conversion from the binary representation of a float to an integer.. You'll just need to do *100 however for pretty good result (some values can't be exactly represented in the float type) So int = float * 100 will give an int with two decimal places.. You cou...
- Sat Jun 26, 2021 8:35 pm
- Forum: Flowcode V8
- Topic: LED Flashing - delay problem
- Replies: 27
- Views: 15483
Re: LED Flashing - delay problem
I think the problem is - the program might execute the main loop multiple times per increment of the timer... (this is less of problem in simulation as it runs a lot slower than the MCU) One solution is to keep a record of where the 'change' time occurs and only change once... led test 2.fcfx Martin
- Sat Jun 26, 2021 10:21 am
- Forum: Flowcode V8
- Topic: LED Flashing - delay problem
- Replies: 27
- Views: 15483
Re: LED Flashing - delay problem
Glad it's (sort of) working for you.
The flashing was a bit odd in simulation too - and I thought it was just timing issues there..
I'll have another play later today - but you'll maybe have it working by then.....
Martin
The flashing was a bit odd in simulation too - and I thought it was just timing issues there..
I'll have another play later today - but you'll maybe have it working by then.....
Martin
- Tue Jun 22, 2021 2:22 pm
- Forum: Flowcode V8
- Topic: LED Flashing - delay problem
- Replies: 27
- Views: 15483
Re: LED Flashing - delay problem
Thanks Martin,
Thought I'd gone with the clock interrupt... Interesting that the simulation worked
Martin
Thought I'd gone with the clock interrupt... Interesting that the simulation worked
Martin
- Mon Jun 21, 2021 1:41 pm
- Forum: Flowcode V8
- Topic: LED Flashing - delay problem
- Replies: 27
- Views: 15483
Re: LED Flashing - delay problem
Hi Frank, What hardware are you using? - as per chart above or changed from that? The program relies on ticks being incremented by the interrupt to mark the passage of time.... So if the interrupt isn't working for some reason (or clock is dramatically slower - say MCU running at 4MHz instead of 40)...
- Mon Jun 14, 2021 6:55 pm
- Forum: Flowcode V8
- Topic: LED Flashing - delay problem
- Replies: 27
- Views: 15483
Re: LED Flashing - delay problem
Okay - a simple demonstration (works okay in SIM and should work better on hardware - timings may vary in SIM depending on your PCs performance) led test.fcfx Note that I've 'simplified' slightly for the sake of clarity - the timer actually runs at 30.518Hz - so the number of ticks in minute would a...
- Mon Jun 14, 2021 1:35 pm
- Forum: Flowcode V8
- Topic: LED Flashing - delay problem
- Replies: 27
- Views: 15483
Re: LED Flashing - delay problem
Yes, something odd with the forums (fora?) yesterday - powercut or DDOS???
I'll tray and make an example program this evening...
Martin
I'll tray and make an example program this evening...
Martin
- Sat Jun 12, 2021 5:20 pm
- Forum: Flowcode V8
- Topic: LED Flashing - delay problem
- Replies: 27
- Views: 15483
Re: LED Flashing - delay problem
The delays 'block' so - here you'll have one channel run - then the 2nd... What I would suggest doing is having a timer interrupt incrementing a timer (for the sake of simplicity here lets say at 1s intervals) Then have in the main loop: if (tick < 60) Set Channel1 on, Set Channel2 off. if (tick > 6...
- Tue May 04, 2021 7:06 am
- Forum: Feature Requests
- Topic: BME680 – Air quality sensor
- Replies: 5
- Views: 7423
Re: BME680 – Air quality sensor
I wrote a basic component - see https://www.matrixtsl.com/mmforums/viewtopic.php?t=22246 There wasn't much interest so left as was - but should work on AVR or PiC (but not MCUs that use i2c transaction mode (Arm and ESP32 amongst others) If there is interest I could alter it to use transactions. Try...
- Wed Apr 14, 2021 7:16 am
- Forum: General Programming
- Topic: Draw a circle using 2 stepper motors
- Replies: 3
- Views: 5798
Re: Draw a circle using 2 stepper motors
That's an interesting idea. Of course the simplest way to draw a circle with two motors is to just use one of them :D If you use two motors you will have to combine horizontal and vertical steps - using an algorithm such as https://www.google.com/url?sa=t&source=web&rct=j&url=https://web.engr.oregon...
- Sun Apr 04, 2021 4:54 pm
- Forum: Programming Tips & Tricks
- Topic: Interface board for Flowcode V8 and above. Now added RTC
- Replies: 33
- Views: 21387
Re: Interface board for Flowcode V8 and above. Now added RTC
Just been experimenting with i2c on the interface board. Can't get it to work reliably - initially I used wi-fi and sometimes results would be correct - other times just 0 returned from i2c reads. Tried with USB and again sometimes results correct / sometimes not... Reading multiple (128) bytes from...
- Sat Apr 03, 2021 6:44 pm
- Forum: User Components
- Topic: New led string to play with. SK6812 - rgbw
- Replies: 19
- Views: 13393
Re: New led string to play with. SK6812 - rgbw
And a datasheet (which seems to show the layout as RGBW) https://cdn-shop.adafruit.com/product-files/2757/p2757_SK6812RGBW_REV01.pdf To confuse the issue - they are also available in RGB form - which accept 24 bit colour (GRB as per ws2812) https://cdn-shop.adafruit.com/product-files/1138/SK6812+LED...
- Thu Apr 01, 2021 11:59 am
- Forum: User Components
- Topic: New led string to play with. SK6812 - rgbw
- Replies: 19
- Views: 13393
Re: New led string to play with. SK6812 - rgbw
Hi Chad, Won't work as is then... The source for the ws2812 component is on the forum @ https://www.matrixtsl.com/mmforums/viewtopic.php?f=76&t=22045&hilit=ws2812 - along with my refresh code which should be easier to modify. Basically need to extend the data transmitted to 32bits (which will make t...
- Wed Mar 31, 2021 12:27 pm
- Forum: User Components
- Topic: New led string to play with. SK6812 - rgbw
- Replies: 19
- Views: 13393
Re: New led string to play with. SK6812 - rgbw
Hi Chad, Just had an experiment with one of these. They take a 32bit value using the same timing as ws2812 leds. I modified my ATTiny85 ws2812 code to take a 32bit colour (note the ws2812 component has 24 bit color - no white - so would need modifying to have a 32 bit buffer. Here I just 'push' valu...
- Sun Mar 14, 2021 7:41 pm
- Forum: User Components
- Topic: Building Components - Step by Step Guide
- Replies: 31
- Views: 89589
Re: Building Components - Step by Step Guide
Looks an interesting project..
Good luck and keep us informed. I might have a go at making one if it works....
Martin
Good luck and keep us informed. I might have a go at making one if it works....
Martin
- Sat Feb 06, 2021 3:09 pm
- Forum: Flowcode V8
- Topic: Convert Int to a decimal number
- Replies: 4
- Views: 2430
Re: Convert Int to a decimal number
Sorry - not at computer now.. but is your value a float?
Just looked and it's an integer value - you'll need a floating point value for your result...
Martin
Just looked and it's an integer value - you'll need a floating point value for your result...
Martin
- Fri Feb 05, 2021 8:43 pm
- Forum: Flowcode V8
- Topic: Convert Int to a decimal number
- Replies: 4
- Views: 2430
Re: Convert Int to a decimal number
In a calculation use:
str = FloatToString$(value, 2) (or change 2 to required number of digits...)
Then print str.. (str defined a string variable..)
Martin
str = FloatToString$(value, 2) (or change 2 to required number of digits...)
Then print str.. (str defined a string variable..)
Martin
- Fri Feb 05, 2021 7:36 pm
- Forum: Flowcode V8
- Topic: Receive string uart rs232
- Replies: 7
- Views: 3939
Re: Receive string uart rs232
Glad to hear you got it working. That bar graph - graduated display looks great!
This forum doesn't have a specific section - I've posted stuff in the 'hints and tips' section....
The new v9 forum has a specific area https://www.flowcode.co.uk/forums/viewforum.php?f=10
Martin
This forum doesn't have a specific section - I've posted stuff in the 'hints and tips' section....
The new v9 forum has a specific area https://www.flowcode.co.uk/forums/viewforum.php?f=10
Martin
- Wed Feb 03, 2021 12:49 pm
- Forum: General Programming
- Topic: how to set or clear individual bits in a veriable??
- Replies: 3
- Views: 4696
Re: how to set or clear individual bits in a veriable??
One way to do it is with '|' (or operator) or to clear bits '&' (and operator)
will set bit 4
will clear bit 4
To set a 'variable' bit
To set or clear multiple bits you can use a mask
will set bits 7..4
Martin
Code: Select all
x = x | (1 << 4)
Code: Select all
x = x & ~(1 << 4)
To set a 'variable' bit
Code: Select all
x = x | (1 << n)
Code: Select all
x = x | 0b11110000
Martin
- Wed Jan 27, 2021 12:13 am
- Forum: Flowcode V8
- Topic: Receive string uart rs232
- Replies: 7
- Views: 3939
Re: Receive string uart rs232
A couple of ideas to try... In the first program: The max string length is limited to 10 chars (receive_pos = (receive_pos + 1) % 10 - receive_pos will go from 0..9 then back to 0 - so increase the 10 to allow for max length of string - might need to increase size of buffer (Data_string) too. What i...
- Tue Jan 26, 2021 1:19 pm
- Forum: Flowcode V8
- Topic: Receive string uart rs232
- Replies: 7
- Views: 3939
Re: Receive string uart rs232
Hi Ronny,
Can you post your code to date? - and I'll try and see why it's just getting the tail of the string...
Martin
Can you post your code to date? - and I'll try and see why it's just getting the tail of the string...
Martin
- Sun Jan 24, 2021 6:54 pm
- Forum: Flowcode V8
- Topic: Receive string uart rs232
- Replies: 7
- Views: 3939
Re: Receive string uart rs232
Hi Ronny, The isCharWaiting function doesn't really have an equivalent in FC - what to do is to have an Rx interrupt that puts received characters into a circular buffer (either the FC component or a simple array and counter) There are examples here https://www.matrixtsl.com/mmforums/viewtopic.php?f...
- Mon Jan 18, 2021 8:00 pm
- Forum: Feature Requests
- Topic: Fast display ST7789!
- Replies: 88
- Views: 185818
- Tue Jan 12, 2021 7:16 pm
- Forum: Bug Reports
- Topic: Clock setting
- Replies: 3
- Views: 3874
Re: Clock setting
Thanks, yes it didn't seem to cause a problem - and gone in v9...
Martin
Martin
- Tue Jan 12, 2021 9:05 am
- Forum: Flowcode V8
- Topic: Maximum String Length for 16 and 32-bit PICs
- Replies: 5
- Views: 5225
Re: Maximum String Length for 16 and 32-bit PICs
Something like: senddata.JPG Where data (an array - you can use any value in the parameter definition, data[2] for example - and then pass any size array (data[10000]). Also pass the length - as mentioned this will allow data arrays (including 0) - if you want to use strings (0 is termination charac...