Hello,
I am trying to write a program to save command information read from a radio control car into the PIC and save to memory for re-creation later and am unsure as how to address the memory. I have attempted to embed a C Code Array into the flowcode but when compiling all the operands are rejected? The purpose is to save the commands for a specific route and then get the car to follow same route on it's own.
Any assistance on how to save this data into memory, whether arrays or other means, would be greatly appreciated.
Many thanks in advance.
Billy
Memory locations for PIC16F877a
-
- Posts: 2
- Joined: Wed Jun 18, 2008 10:20 am
- Contact:
-
- Valued Contributor
- Posts: 548
- Joined: Tue Jun 26, 2007 11:23 am
- Has thanked: 6 times
- Been thanked: 44 times
- Contact:
Re: Memory locations for PIC16F877a
Hello Billy,
There are several ways to store arrays of data from Flowcode. A Flowcode string variable is an array and can be accessed as an array directly from Flowcode using the calculation block instead of the string functions.
As an example, The 7th byte of a string variable 'myStr' can be accessed from a calculation block as myStr[6] = 54, or myByte = myStr[6].
The default string size of 20 characters can be changed when the variable is declared.
An alternative is to use the internal EEPROM. There are 256 bytes available in the 16F877A and a Flowcode component to access them. This EEPROM also has the possible advantage that the data will not be lost when power is removed, but is relatively slow to write to.
The Flowcode access functions for arrays and EEPROM can only handle 'byte' (8-bit) values so any larger data types will need to be split into bytes and written individually, and re-combind when read.
There are several ways to store arrays of data from Flowcode. A Flowcode string variable is an array and can be accessed as an array directly from Flowcode using the calculation block instead of the string functions.
As an example, The 7th byte of a string variable 'myStr' can be accessed from a calculation block as myStr[6] = 54, or myByte = myStr[6].
The default string size of 20 characters can be changed when the variable is declared.
An alternative is to use the internal EEPROM. There are 256 bytes available in the 16F877A and a Flowcode component to access them. This EEPROM also has the possible advantage that the data will not be lost when power is removed, but is relatively slow to write to.
The Flowcode access functions for arrays and EEPROM can only handle 'byte' (8-bit) values so any larger data types will need to be split into bytes and written individually, and re-combind when read.
-
- Posts: 2
- Joined: Wed Jun 18, 2008 10:20 am
- Contact:
Re: Memory locations for PIC16F877a
Hi Sean,
Thanks for the help there, you've been greatly helpful. We'll probably use the EEPROM method you spoke of as i don't believe the string will be large enough. 256 Bytes should be grand though.
Many Thanks
Billy
Thanks for the help there, you've been greatly helpful. We'll probably use the EEPROM method you spoke of as i don't believe the string will be large enough. 256 Bytes should be grand though.
Many Thanks
Billy