S Suraj143 Active Member Oct 28, 2019 #1 Want to know the time takes (Cycles) after loading the 1st SSP1BUF to the next SSP1BUF..... Thanks Code: ;SPI Clock = 1.5uS (Period) ;Instruction Cycle = 250nS movwf SSP1BUF ;Previous Write to SPI ; ;From Here Needs the timing to next SSP1BUF ; movf INDF0,W call Table_2 movlb .0 ;switch to Bank0 btfss PIR1,SSP1IF ;Has the byte been sent goto $-1 ;No bcf PIR1,SSP1IF movlb .4 ;switch to Bank4 movwf SSP1BUF ;Time ?? Table_2 addwf PCL,F retlw 00h retlw .1 retlw .10 retlw .8 retlw .16 retlw .53 retlw .2
Want to know the time takes (Cycles) after loading the 1st SSP1BUF to the next SSP1BUF..... Thanks Code: ;SPI Clock = 1.5uS (Period) ;Instruction Cycle = 250nS movwf SSP1BUF ;Previous Write to SPI ; ;From Here Needs the timing to next SSP1BUF ; movf INDF0,W call Table_2 movlb .0 ;switch to Bank0 btfss PIR1,SSP1IF ;Has the byte been sent goto $-1 ;No bcf PIR1,SSP1IF movlb .4 ;switch to Bank4 movwf SSP1BUF ;Time ?? Table_2 addwf PCL,F retlw 00h retlw .1 retlw .10 retlw .8 retlw .16 retlw .53 retlw .2
Ian Rogers User Extraordinaire Forum Supporter Most Helpful Member Oct 28, 2019 #2 It will be the eight clock cycles... But multiply by which ever FOSC /? you have used in the SSPCON1 register.. Most of us just poll the SSPIF flag, that tells you when its done. ( clear it first before filling SSPBUF..) edit** I see you have done that!!
It will be the eight clock cycles... But multiply by which ever FOSC /? you have used in the SSPCON1 register.. Most of us just poll the SSPIF flag, that tells you when its done. ( clear it first before filling SSPBUF..) edit** I see you have done that!!
S Suraj143 Active Member Oct 28, 2019 #3 Ok. For example for 8 bits if it takes 12uS time I have to wait 12uS time after I load it to SSPIBUF? In other words I have to poll until 12uS time?
Ok. For example for 8 bits if it takes 12uS time I have to wait 12uS time after I load it to SSPIBUF? In other words I have to poll until 12uS time?
Ian Rogers User Extraordinaire Forum Supporter Most Helpful Member Oct 28, 2019 #4 Suraj143 said: Ok. For example for 8 bits if it takes 12uS time I have to wait 12uS time after I load it to SSPIBUF? In other words I have to poll until 12uS time? Click to expand... no.. just wait for the flag.. You're code snippet has this already..
Suraj143 said: Ok. For example for 8 bits if it takes 12uS time I have to wait 12uS time after I load it to SSPIBUF? In other words I have to poll until 12uS time? Click to expand... no.. just wait for the flag.. You're code snippet has this already..
S Suraj143 Active Member Oct 28, 2019 #5 Ya I know I have to wait until Flag Occurs.What I mean was the flag will occur after 12uS time after I loaded to SSP1BUF!!
Ya I know I have to wait until Flag Occurs.What I mean was the flag will occur after 12uS time after I loaded to SSP1BUF!!
Ian Rogers User Extraordinaire Forum Supporter Most Helpful Member Oct 28, 2019 #6 what have you set SSPCON1 to.. FOSC / what? The way you have it is :- Is the last byte gone? Yes. Send next one No. wait a bit I do it the other way round as I want what has come:- clear flag Put byte in buff wait for flag return whats come back... Then you get full duplex..
what have you set SSPCON1 to.. FOSC / what? The way you have it is :- Is the last byte gone? Yes. Send next one No. wait a bit I do it the other way round as I want what has come:- clear flag Put byte in buff wait for flag return whats come back... Then you get full duplex..