This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Help with uvision 3 and 89LPC936 with SPI

Dear All,

I am new in prograqmming the 89LPC639 and with the keil uvision version 3.
The problem that i face is that, when i try to start the SPI seems nothing happened.
First the SPDAT does not take the value that i try to put in.
Second in logic analyzer at pins which are for the SPI protocol nothing occurs. I could not know what i am making wrong so i hope a advance user could help me with that.

Also i am include the code.

void Spi_Send(unsigned int value){

P2|=0x34; P2M1 |= 0x34; P2M2 = 0x34; SPSTAT |= 0x80; SPCTL=0xD0; SPDAT=value;

while ((SPSTAT & 0x80)==0){ }

}

Parents Reply Children
  • Is it possible to do the same thing without the usage of interrupts?
    sure, if you want your process to come to a screeching halt.

    I try to avoid the interrupts because i am not familiar with them yet.
    STOP what you are doing and get "familiar with them".
    trying to get by without interrupts "because i am not familiar with them yet" will do two things
    1) pretty soon force you to recode the whole mess
    2) give you some very nasty habits

    Interrupts are not complex, they are the main device to keep embedded systems running "on time'

    Erik

    PS the ready made code from CodeArchitect does it for you