hi,When I connect it to the DATA switch input, it shows, see attached:
Hi E,hi,
A circuit showing the DATA switch and a Code clip would help.
E
Hi E,Hi E,
It's difficult to show the relevant CODE,as it's scattered in various places, here's the actual switch section. I've tried ON/OFF, but it's a bit tricky.
Here's the PCB (7)
I didn't want to get too detailed, at the moment anyway, more of a general what could cause it question.
C
'BMP280 UTILITIES
'Initialize BMP280
Proc init_BMP280() 'init_BMP280 ':
Symbol altmtr_cs = LATD.3 'BMP280 BAROMETER/TEMP [ Moved from GLOBAL SYMBOL needs setting for each PROC instance (Perhaps use INCLUDE?)]]
adr = 0x88
'Compensation parameters
WaitUs 10
For i = 0 To 23
altmtr_cs = 0 'CHIP SELECT BMP280 ON
SSPBUF = adr 'SPISend adr
While Not SSPSTAT.BF 'If buffer empty do nothing
Wend
data = SSPBUF 'SPIReceive data
WaitUs 2
b(i) = data
adr = adr + i
altmtr_cs = 1 'CHIP SELECT BMP280 OFF
Next i
If adr = 0xa1 Then adr = 0x88 '(poss 0x9f)
'Temp coefficents
t1.LB = b(0)
t1.HB = b(1)
t2.LB = b(2)
t2.HB = b(3)
t3.LB = b(4)
t3.HB = b(5)
'pressure coefficients
p1.LB = b(6)
p1.HB = b(7)
Hi J,Show the SPI_init() for the BMP280.
I would first try to read the ident byte from BMP280.
If you send an address to read from, you get the data on the next write to BM280.
Proc spi_init() 'looks like straight from the datasheet
'4620
'PORTA.4 = 0 'SS Sets SS PIN on PIC2 [[MOVED to PIC2 SPECIFIC CALL ]]
PORTD.3 = 0 'BMP280_cs
TRISC.3 = 0 'clk to Slave
TRISC.4 = 1 'sdi from slave
TRISC.5 = 0 'sdo to slave
'MODE 0,0
SSPSTAT.SMP = 0 'sample a mid data
SSPSTAT.CKE = 1
SSPSTAT.5 = 0 'I2C only
SSPSTAT.4 = 0 'I2C only
SSPSTAT.3 = 0 'I2C only
SSPSTAT.2 = 0 'I2C only
SSPSTAT.1 = 0 'I2C only
SSPSTAT.BF = 0 'If SSPBUF=1=Full
SSPCON1.WCOL = 0 'Collision detect
SSPCON1.SSPOV = 0 'Overflow
SSPCON1.SSPEN = 1 'Configure SCK,SD0,SDI,/SS
SSPCON1.CKP = 0 'Clock Idle Low, Active High
SSPCON1.SSPM3 = 0 '0010 = SPI Master Mode Fosc/64
SSPCON1.SSPM2 = 0
SSPCON1.SSPM1 = 1
SSPCON1.SSPM0 = 0
End Proc
Hi J,#167 tries to read the calibration data from BMP280.
I mean measurement control and configuration of the BMP280.
You had a working version with Oshonsoft SPIsend, SPIreceive functions.
Try to read the ID byte from BMP280. If it works then copy the rest from the old working program.
Define SIMULATION_WAITMS_VALUE = 1 'Comment in for SIM out for PIC
'----------- SYSTEM CONFIG --------------------
'PIC Config
Define CONFIG1L = 0x00
Define CONFIG1H = 0x02 '8=INT 2=EXT
Define CONFIG2L = 0x1e
Define CONFIG2H = 0x00
Define CONFIG3L = 0x00
Define CONFIG3H = 0x81 'Set for HVP
Define CONFIG4L = 0x80
Define CONFIG4H = 0x00
Define CONFIG5L = 0x0f
Define CONFIG5H = 0xc0
Define CONFIG6L = 0x0f
Define CONFIG6H = 0xe0
Define CONFIG7L = 0x0f
Define CONFIG7H = 0x40
Define CLOCK_FREQUENCY = 8
'Set up UART and RX interrupt for immediate use
Hseropen 9600 'does a basic config of TX and RX including BAUDCON, SPEN, CREN, TXEN etc.
Hserout "TEST", CrLf
End
by Aaron Carman
by Duane Benson
by Jake Hertz
by Jake Hertz