hi C,However, I think it will break when used live for RC control, because of latency. I may be wrong??
As always, write a short debug program to check the functions that your main program will use, before adding the code to the main program.
E
hi C,However, I think it will break when used live for RC control, because of latency. I may be wrong??
Hi E,hi C,
As always, write a short debug program to check the functions that your main program will use, before adding the code to the main program.
E
Hi E,hi,
Do understand the TRIS command.?
To drive an LED, the pin has to set as an OUTPUT.
E
Hi E,hi E,
If you recall, we did this working SPI to SPI link, back in 2019.
E
Hi E,hi E,
If you recall, we did this working SPI to SPI link, back in 2019.
E
------------------------ MASTER -----------------------------------------------------
m2s(0) = 0 '0=DUMMY +35 BYTES =36 BYTES
m2s(1) = 1 '=X for M2S tests.
m2s(2) = 2
m2s(3) = 3
m2s(4) = 4
m2s(5) = 5
m2s(6) = 6
m2s(7) = 7
m2s(8) = 8
m2s(9) = 9
m2s(10) = 10
m2s(11) = 11
m2s(12) = 12
m2s(13) = 13
m2s(14) = 14
m2s(15) = 15
m2s(16) = 16
m2s(17) = 17
m2s(18) = 18
m2s(19) = 19
m2s(20) = 20
m2s(21) = 21
m2s(22) = 22
m2s(23) = 23
m2s(24) = 24
m2s(25) = 25
m2s(26) = 26
m2s(27) = 27
m2s(28) = 28
m2s(29) = 29
m2s(30) = 30
m2s(31) = 31
m2s(32) = 32
m2s(33) = 33
m2s(34) = 34
m2s(35) = 35
slave4431_cs = 0 'CS ON
While Not s2m_ack
Wend
For spipsn = 0 To 35 'spipsn To 35 '=36 BYTES including 1x DUMMY BYTE 'GPS=31 $-W INC QEI=2 BATVOLT=1 SPARE DATA=1<<£
SSPBUF = m2s(spipsn) '(spipsn)
While Not SSPSTAT.BF
Wend
s2m(spipsn) = SSPBUF '(spipsn) = SSPBUF '£ ADDED
WaitMs 1
Next spipsn
slave4431_cs = 1 'CS OFF
-------------------------------------------------------------------------
S2M has been PARSED from a GPS buffer +QEI readings +2xBYTES
---------------------------- SLAVE -----------------------------------------------
s2m(0) = "£" '£ [TOT 35 BYTES ]
s2m(1) = gps(7) 'Time
s2m(2) = gps(8) 'Time
s2m(3) = gps(9) 'Time
s2m(4) = gps(10) 'Time
s2m(5) = gps(11) 'Time
s2m(6) = gps(12) 'Time
s2m(7) = gps(14) 'Time
s2m(8) = gps(15) 'Time
s2m(9) = gps(19) 'Lat
s2m(10) = gps(20) 'Lat
s2m(11) = gps(21) 'Lat
s2m(12) = gps(22) 'Lat
s2m(13) = gps(24) 'Lat
s2m(14) = gps(25) 'Lat
s2m(15) = gps(26) 'Lat
s2m(16) = gps(27) 'Lat
s2m(17) = gps(27) 'Lat
s2m(18) = gps(28) 'Lat
s2m(19) = gps(30) 'N
s2m(20) = gps(32) 'Lon
s2m(21) = gps(33) 'Lon
s2m(22) = gps(34) 'Lon
s2m(23) = gps(35) 'Lon
s2m(24) = gps(36) 'Lon
s2m(25) = gps(38) 'Lon
s2m(26) = gps(39) 'Lon
s2m(27) = gps(40) 'Lon
s2m(28) = gps(41) 'Lon
s2m(29) = gps(42) 'Lon
s2m(30) = gps(44) 'W
s2m(31) = POSCNTL 'QEIDEGLB
s2m(32) = POSCNTH 'QEIDEGHB
s2m(33) = 12 'Bat volt
s2m(34) = 123 'Spare DATA
If slave4431_cs = 0 Then 'if chip select on do the code otherwise skip
s2m_ack = 1 'Tell MASTER that SLAVE is ready.
For spipsn = 0 To 34 'GPS=30 $-W INC, QEI=2 BATVOLT=1 SPARE DATA=1
m2s(spipsn) = SSPBUF '(spipsn) = SSPBUF 'M2S
While Not SSPSTAT.BF
Wend
SSPBUF = s2m(spipsn) '(spipsn)
Next spipsn
s2m_ack = 0 'Set S2M_ack off till next loop
Endif 'slave4431_cs
----------------------------------------------------------------------------------------