hi ! i am new to keil ... currenly , i am working on p89v51 to enable the spi mode and use it with sd card...
my problem is i cant get output on port 1 pins (ss,mosi,miso,sck)
#include <stdio.h> #include <p89v51rd2.h> void spi_init() { P1 = 0xBF; // defines i/o pins SS = 1; // sets the chip select pin high SPCFG = 0x00; // clears spi flag SPCTL = 0x5B; // selecting master mode and other configurations } void main() { spi_init(); // spi mode initialization while(1) { SS = 0; SPDAT = 0xAA; // sends AAh to slave device while (!(SPCFG & 0x80)); SPCFG =0x00; SS = 1; } }
i have looked to port1 in analysis windows but nothing comes up? any kind of help would be appreciated.......
Thanks in advance...
very likely the code generated by the CodeArchitect for LPC936 (free from http://www.esacademy.com ) will work. Tonfind out all it will require is a quick datasheet compare. I KNOW that the LPC for IIC works on the 66x, so I consider it very likely that the LPC SPI code will work on the RD2
Erik
PS I do not like the code, but it makes for an excellent working template