Robin Davis

Mapping a structure to a port.

Discussion created by Robin Davis on Apr 25, 2008
Latest reply on Apr 25, 2008 by Robin Davis
Hi to all.
I am porting some code from a PIC to a HCS12 micro. I want to use the
same lcd routines on the new micro. I seem to have it mostly figured out
but I,m not sure how to "map" the lcd structure onto the hcs12 port(Port AD I/O Register; address 0x00000270)
I'm fairly new to this sort of stuff and am a bit stuck.

Ive tried this , but it does not work. It compiles but the outputs don't work.
My lack of "C" knowledge is letting me down here I think :0(


struct lcd_pin_map

         char unused   :1;     
         char enable    :1;
         char rs           :1;               // access to the LCD pins.
         char rw          :1;
         char data       :4;                    // The bits are allocated from

struct lcd_pin_map lcd;

#define lcd_pin_map lcd @ (*((volatile unsigned char *)(REG_BASE + 0x00000270)))

I basically want to connect the lcd(16*2) to port AD.

If anyone has any other nice lcd routines I'm happy to try them out.

Any help appreciated.