Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PIC 18F family - Actual use of WCOL flag (SSPCON1,7)

Status
Not open for further replies.

atferrari

Well-Known Member
Most Helpful Member
SPI - micro has to transmit only.

I couldn't find a good (practical) use for the WCOL flag (Write collision detect bit).

The way I understand it, I should first write to SSPBUF and then check that flag to see if I was allowed to write. Kind of: "do it and I will tell you if you did right or wrong".

I expected to have a "busy" flag, pretty much like the one in the classic LCD displays that when it is cleared, you know you can go ahead with the next byte.

Is my interpretation wrong?
 
If your send routine sort of looks like this:
Code:
Proc spi_send(spi_data As Byte)
	While SSPSTAT.BF = 0
	Wend  'Wait until buffer is clear
	SSPBUF = spi_data
End Proc
then and you're only sending/transmitting, there is little chance the WCOL bit will ever be set. The WCOL will be set if the Buffer is full and you attempt to write to it before it's emptied.
 
Last edited:
Thanks for replying
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top