Remote control by location (PIC in Oshonsoft)

ericgibbs

Joined Jan 29, 2010
18,862
hi,

Master.
ss = 1
WaitMs 5' way too long... use WaitUs
ss = 0



Slave.
While ss = 1
Wend

SSPBUF = qeiazi.LB
While Not SSPSTAT.BF
Wend
m2s1 = SSPBUF

You are not testing for ss

SSPBUF = qeiazi.HB
While Not SSPSTAT.BF
Wend
m2s2 = SSPBUF

Serout PORTC.3, 9600, "From Master=", #m2s1, #m2s2, CrLf
 

Thread Starter

camerart

Joined Feb 25, 2013
3,730
hi,

Master.
ss = 1
WaitMs 5' way too long... use WaitUs
ss = 0



Slave.
While ss = 1
Wend

SSPBUF = qeiazi.LB
While Not SSPSTAT.BF
Wend
m2s1 = SSPBUF

You are not testing for ss

SSPBUF = qeiazi.HB
While Not SSPSTAT.BF
Wend
m2s2 = SSPBUF

Serout PORTC.3, 9600, "From Master=", #m2s1, #m2s2, CrLf
Hi E,

SS added between the READS
WaitUs
used.
Why is the [ QEIAZI.LB ] showing [ 2 ]?
C.
 

ericgibbs

Joined Jan 29, 2010
18,862
hi,
It appears to be, I will get my test rig set up this afternoon.
Changing the 4431 to 2431 is not a problem, I think its the only way I can be sure its the program and not your hardware.
E
 

Thread Starter

camerart

Joined Feb 25, 2013
3,730
hi,
It appears to be, I will get my test rig set up this afternoon.
Changing the 4431 to 2431 is not a problem, I think its the only way I can be sure its the program and not your hardware.
E
Hi E,
It's just dawning on me that [ SSPBUF ] doesn't know which BYTE it is transferring, apart from naming it at each PIC, after transmission. Am I correct?
C.
 

ericgibbs

Joined Jan 29, 2010
18,862
hi,
The way I have it set up is the Master sends 270 decimal [ 0x01 0x0E] to the Slave, waits 1 second then repeats.
The Slave replies with 359 decimal [0x01 0x67] when its receiving the 359.

The first exchange is correct. following exchanges are corrupted, will continue checking.
BTW: The scope shows the same waveforms as the above results.
E
 
Last edited:

Thread Starter

camerart

Joined Feb 25, 2013
3,730
hi,
The way I have it set up is the Master sends 270 decimal [ 0x01 0x0E] to the Slave, waits 1 second then repeats.
The Slave replies with 359 decimal [0x01 0x67] when its receiving the 359.

The first exchange is correct. following exchanges are corrupted, will continue checking.
BTW: The scope shows the same waveforms as the above results.
E
Hi E,
It looks as though your SENDing A WORD, I'm intrigued to see how.
C
 

Thread Starter

camerart

Joined Feb 25, 2013
3,730
Morning E,
It appears that these 2x programs are working ok ???
With or without the [ waitms 500 ] Search for [ ++++++++++++++++ ]

EDIT: SLAVE: I tried [ 359 ] and here's the TERM view.
C
C.
 

Attachments

Last edited:

Thread Starter

camerart

Joined Feb 25, 2013
3,730
Hi E,
Here's the CSV file from your #492 programs adapted.
Great stuff, now let me see if I can join the AZI programs with these.
Thanks.
C
 

Attachments

ericgibbs

Joined Jan 29, 2010
18,862
Hi C,
Some pointers.
The programs are written for the 'burst' mode, which means the current 2 Byte read can be increased in Byte pair steps, to suit the Registers.
When you are addressing the BMP registers, the first SPI exchange is the BMP Reg address, followed by the required number of Byte Reads.
The first Write from the Master to the BMP is the BMP Reg address you which to Read in burst mode, the data the BMP sends to the Master is not valid data.

E
 

Thread Starter

camerart

Joined Feb 25, 2013
3,730
Hi C,
Some pointers.
The programs are written for the 'burst' mode, which means the current 2 Byte read can be increased in Byte pair steps, to suit the Registers.
When you are addressing the BMP registers, the first SPI exchange is the BMP Reg address, followed by the required number of Byte Reads.
The first Write from the Master to the BMP is the BMP Reg address you which to Read in burst mode, the data the BMP sends to the Master is not valid data.

E
Hi E,
When you say "BMP" if you mean BMP280, then this has already been done in the MAIN program, also the AK8963C. Both working fine.
Next for me is to get the SLAVE PIC to READ the QEI, which has already been done, and interweave it into your SLAVE program.
Thanks for setting up etc.

EDIT: The #494 CSV file is the same today, but here is a TERM view:
What is the extra number[ 26369 ]?
EDIT EDIT: Here's my first attempt at combining the 2x SLAVE programs.
While turning the QEI KNOB CW. Note the larger number. I think that's something to do with a kind of 'button bounce' type thing.
C
 

Attachments

Last edited:

jjw

Joined Dec 24, 2013
823
What is the resolution of the encoder?
Many high byte values seem to be too big.
Or are the bytes exchanged?
 
Last edited:

ericgibbs

Joined Jan 29, 2010
18,862
hi C,
Looking at that TERM.txt, I agree with 'jjw' it looks wrong.?
Why are you printing the HB and LB bytes separately instead of a WORD value.?
E
 
Top