I am trying to use as little memory as possible,
using Atmel Sudio 6 on a ATMega328p
I want to break apart a BYTE for control.
and for Error detection.
Example 1 :
LEFT | RIGHT
Motor byte x x x x | x x x x
| | | Dir | | | Dir
3bit Speed 3bit Speed
I don't need 255 Levels of speed control 0-7 will be fine.
I would like to code as
Motor.LSpeed = 0; Motor.LDir = 0 ...
Example 2 :
Control byte x x x x x x x x
| | | | | | 2bit mode sel
| | | | sensor motor control
| | | Blue LED
| | Red LED
Control.Mode=0; // 0-3
Control.Sensor=0; // 0-3
Control.Blue = 0; // blue LED on or off
Control.Red = 0; // Red LED on or off
Control.Error = 0; // Bit high when ERROR
Or something like that ..
I have seen setting up Struct definitions... but can't seem to get it to work ...
Any suggestions will be greatly appreciated ...