We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I've just started playing with MCB2130 and did some examples.
Now I would like to enable / clear leds with external file. So, I would write a text file, each line would be a led address that would stay on for some time, then it would clear that and enable the second one... till it reaches the end of this file.
My biggest problem is - how to load a file into memory (I was looking at voice player example, so by using flash.ini file, but is this the right way for simple text files??? Do I need to convert them to some other format?)
- how to read such file (Is it always at same memory address, how to determine it's length...)
I'm not sure if this is the right approach to this problem at all, but instructions needs to be in a file.
Use interrupt-driven serial communication. Many samples available if you google for it.
Then your main loop can run a loop that checks if it is time to change state of a diode or if the input buffer have one or more received characters to process.
If you poll the serial port, then you must poll it often enough that you will react and fetch a received character before the next character arrives - normally around 10 times the baudrate. With 9600 baud, it takes about 10ms for each character to be transmitted. Polling at a slower speed will result in one or more lost character. With interrupt-driven communication, the size of the receive buffer will allow the main loop to take longer time to check if there are received data, without any loss. Sometimes, it can be enough to have a 8 or 16-character receive buffer to solve any problems with lost characters.