Some days feel a bit slow, and you don't get much work done. The work you do get done, though, feels well worth it. Today I tested out the serial interface, and produced a test pattern which should be useful for testing the floor sensors.
Serial Interface
Following the examples from the AVR data book, I designed a simple echo program, which sits in a loop waiting for a USART receive to complete. The character is them read into a variable, written to the LED display (so something can be seen to show that the AVR is receiving something), and then transmitted back via the USART.
To keep the communication simple, I used no flow control, 9600 baud (quite slow, but quick enough for testing, and for the time being), no parity checking, and a single stop bit.
I used the Mini-ITX board to test the interface. When I started it up, I got a CMOS checksum error message, so the backup cell might need replacing. I'll see how it goes.
I used Moserial as a serial terminal - it was pretty easy to configure. Testing with simple text strings showed that something was wrong. At this stage the AVR was being set up using a calculated constant. Since the errors were very repeatable, I changed the program to use a value from the data book tables. The communication was then perfect, and I realised that my calculation was using the wrong divisor. After rectifying it, I found it to work flawlessly.
Unfortunately, moserial can't send and receive files simultaneously, otherwise I'd be able to conduct a more thorough test of the system. Anyway, the USART seems to work fine.
Floor Sensor Test Pattern
When I finally get round to the floor sensor circuit, I'll want to consider linearity. Taking laser printed black as 'dark' and plain paper as 'white', I've constructed a grey scale on A3 paper with indication marks to show each 25% increment from 0% (dark) to 100% (light). By moving the robot on this pattern, the linearity of the sensor can be determined. Testing a circuit has been left for next week now.
Floor Sensor Calibration Scale - Note extension of solid black beyond 0% mark |
No comments:
Post a Comment
Comments are moderated. Sometimes it might take me a long time to get round to it, so please be patient.