Morning E,hi C,
The only way with OSH Basic is,
SPISend 0x3C
SPISend 0x0A
The method I use is:
Problem you will have to use this method throughout the Code listing, major change.
''Code fragment to Send Data
lcd_mode = 1
ss = 0
spi8 = SSPBUF
SSPBUF = data.HB
While Not SSPSTAT.BF
Wend
spi8 = SSPBUF
SSPBUF = data.LB
While Not SSPSTAT.BF
Wend
ss = 1
'initialise the SPI Port at start up.
Proc spi_init()
TRISC.5 = 0 'sdo to 9225
TRISC.2 = 0 'TRISC.2 = 0 'ss
TRISC.4 = 1 'sdi not used on TFT
TRISC.3 = 0 'clk
ss = 1
SSPSTAT = 0
'SSPSTAT.CKE = 1 'clock edge unrem for trailing edge
'SSPCON1 = 0x10 ' at 8mhz 2mhz operation no SS control
SSPCON1 = %00100000
'00 = fosc/4.. 01 = fosc /16
'10 = fosc/64.. 11 controlled by timer2.
SSPCON1.CKP = 1 'clock polarity unrem for high polarity
End Proc
E
Hi E,hi C,
If the actual Addr = 0x0A, you would increment after you have you have Read that Addr's contents.
E
The full image is as tiny as the thumbnail.Hi,
After failing to get sensible results, I decided to try it with a logic analyser, and notice something that wasn't immediately obvious.
See the attached jpg, there are some solder links.
I connected across the SPI jumper, and guess that the C/S link is for holding the Compass 'on' once it has been programmed.
The logic analyser showed one REG default setting ok, so I'll go over some of the old settings tomorrow. Should prove positive.
C
Hi S,The full image is as tiny as the thumbnail.
Hi E,hi C,
The only way with OSH Basic is,
SPISend 0x3C
SPISend 0x0A
The method I use is:
Problem you will have to use this method throughout the Code listing, major change.
''Code fragment to Send Data
lcd_mode = 1
ss = 0
spi8 = SSPBUF
SSPBUF = data.HB
While Not SSPSTAT.BF
Wend
spi8 = SSPBUF
SSPBUF = data.LB
While Not SSPSTAT.BF
Wend
ss = 1
'initialise the SPI Port at start up.
Proc spi_init()
TRISC.5 = 0 'sdo to 9225
TRISC.2 = 0 'TRISC.2 = 0 'ss
TRISC.4 = 1 'sdi not used on TFT
TRISC.3 = 0 'clk
ss = 1
SSPSTAT = 0
'SSPSTAT.CKE = 1 'clock edge unrem for trailing edge
'SSPCON1 = 0x10 ' at 8mhz 2mhz operation no SS control
SSPCON1 = %00100000
'00 = fosc/4.. 01 = fosc /16
'10 = fosc/64.. 11 controlled by timer2.
SSPCON1.CKP = 1 'clock polarity unrem for high polarity
End Proc
E
Hi E,hi C,
Look at d/s Section 7.1.4 CTRL_REG4_A SIM
E
Hi E,hi C,
It is this one LSM303 D as per your post.
E