简体   繁体   中英

embedded programming in c with pointers

When I am try to compile the following program it shows an error in the line LCDCMEMCTL[i] = digit[i]; as this expression must have pointer to object type.Can you please help meto find what is the reason behind it and how to solve this.

#include "msp430f6736.h"

char digit[10] = {
    0xB7, /* "0" LCD segments a+b+c+d+e+f */
    0x12, /* "1" */
    0x8F, /* "2" */
    0x1F, /* "3" */
    0x3A, /* "4" */
    0x3D, /* "5" */
    0xBD, /* "6" */
    0x13, /* "7" */
    0xBF, /* "8" */
    0x3F  /* "9" */
};

void main(void)
{
    int i;

    /* Initialize LCD driver (4Mux mode) */
    LCDCCTL0 = 0xFF;

    /* display "6543210" */
    for (i=0; i<7; i++)
    {
       LCDCMEMCTL[i] = digit[i];
    }
}

You might need to provide more input if I've found the wrong one... but from what I found in the msp430f6736.h header file :

#define LCDCMEMCTL_           0x0A06    /* LCD_C memory control register */
sfrb(LCDCMEMCTL_L , LCDCMEMCTL_);
sfrb(LCDCMEMCTL_H , LCDCMEMCTL_+1);
sfrw(LCDCMEMCTL, LCDCMEMCTL_);

It looks like LCDCMEMCTL is the address of the LCD's memory control register. I haven't found a reference manual for this IC yet, so I don't know what the register looks like. But normally you'd write the full sequence of bytes to the register, a lot of times TI provides macros for writing these.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM