Page 1 of 1

12f1840 spi inop

Posted: Tue Nov 26, 2013 9:21 am
by brandonb
is there anything special to do on this chip to get spi working? i wrote spi code for it and can't get it working either, i get one pulse on power on and thats it, did internet search and erratica search but shows nothing... can someone look into this for me have plans for it if resolved
forgot to say i also tried this with alternate pins

Re: 12f1840 spi inop

Posted: Thu Nov 28, 2013 8:38 am
by brandonb
this works in flowcode, a brain glitch on my part :lol:

Re: 12f1840 spi inop

Posted: Sat Nov 30, 2013 6:58 pm
by brandonb
ben: i was excited and forgot to initialize in flowcode.....im writing librarys for this by looking at datasheet and i found that any chip with 1800 in the name the sspif bit does not set when using it to determine message complete, this is kind of weird because its the way they instructed in datasheet and does work correctly on the 1900 chips, what i did to fix this in my code to determine when message is sent/received in which obviously is the way you guys do it because its the only way to make it work by polling the bf bit in sspstat in a while loop

Code: Select all

char spi_get(void){
  sspbuf=0;// send dummy
  while((sspstat&1)==0);// wait for done (BF_bit)
  return sspbuf;// return read
}

void spi_send(char send_it){
  sspbuf=send_it;
  while((sspstat&1)==0);// wait for done (BF_bit)
  send_it=sspbuf;
}