hemnath
Advanced Member level 3
- Joined
- Jun 24, 2012
- Messages
- 702
- Helped
- 61
- Reputation
- 120
- Reaction score
- 57
- Trophy points
- 1,308
- Location
- Chennai
- Activity points
- 6,589
I'm learning spi mode. Using CCS c compiler.
this is the routine for spi write,
But the errors are points to the main loop in the SPI_Write,
Errors shown are,
*** Error 58 "main.c" Line 112(20,24): Expecting a close paren
*** Error 58 "main.c" Line 113(20,24): Expecting a close paren
*** Error 58 "main.c" Line 114(20,24): Expecting a close paren
*** Error 58 "main.c" Line 115(19,23): Expecting a close paren
*** Error 58 "main.c" Line 116(19,23): Expecting a close paren
Thanks in advance
this is the routine for spi write,
HTML:
void SPI_Write(unsigned char addr,unsigned char data)
{
// Activate the SS SPI Select pin
PORT_C6 = 0;
// Start MCP23S17 OpCode transmission
SSPBUF = SPI_SLAVE_ID | ((SPI_SLAVE_ADDR << 1) & 0x0E)| SPI_SLAVE_WRITE;
// Wait for Data Transmit/Receipt complete
while(!BF);
// Start MCP23S17 Register Address transmission
SSPBUF = addr;
// Wait for Data Transmit/Receipt complete
while(!BF);
// Start Data transmission
SSPBUF = data;
// Wait for Data Transmit/Receipt complete
while(!BF);
// CS pin is not active
PORT_C6 = 1;
}
In main loop,
SPI_Write(IOCONA,0x28); // I/O Control Register: BANK=0, SEQOP=1, HAEN=1 (Enable Addressing)
SPI_Write(IODIRA,0x00); // GPIOA As Output
SPI_Write(IODIRB,0xFF); // GPIOB As Input
SPI_Write(GPPUB,0xFF); // Enable Pull-up Resistor on GPIOB
SPI_Write(GPIOA,0x00); // Reset Output on GPIOA
But the errors are points to the main loop in the SPI_Write,
Errors shown are,
*** Error 58 "main.c" Line 112(20,24): Expecting a close paren
*** Error 58 "main.c" Line 113(20,24): Expecting a close paren
*** Error 58 "main.c" Line 114(20,24): Expecting a close paren
*** Error 58 "main.c" Line 115(19,23): Expecting a close paren
*** Error 58 "main.c" Line 116(19,23): Expecting a close paren
Thanks in advance