MrDEB
Well-Known Member
trying to get a OW device (DS18B20) to display on an LCD display.
Starting from ground zero again and seeing if I can even communicate with the sensor
tried several codes but nada
going to start with the code that displays using the usart but how to get it to display on computer screen?
figure I would start there again
using a Junebug for programming.
And yes I can get text to display on the LCD by including LCD bas and removing usart bas
Starting from ground zero again and seeing if I can even communicate with the sensor
tried several codes but nada
going to start with the code that displays using the usart but how to get it to display on computer screen?
figure I would start there again
using a Junebug for programming.
And yes I can get text to display on the LCD by including LCD bas and removing usart bas
Code:
// device and clock speed...
device = 18F452
clock = 20
// import modules...
include "DS18B20.bas"
include "convert.bas"
include "usart.bas"
// FAMILY $28 ($1D) ($0000002CDBAE) <- DS18B20
// FAMILY $28 ($3F) ($0000002CD16E) <- DS18B20
const Sensor_A(8) as byte = ($28, $AE, $DB, $2C, $00, $00, $00, $1D)
const Sensor_B(8) as byte = ($28, $6E, $D1, $2C, $00, $00, $00, $3F)
// display a sensor value...
sub DisplaySensor(byrefconst pID() as byte)
dim TempA as shortint
dim TempB as word
RomID = pID
Convert
GetTemp(TempA, TempB)
USART.Write(DecToStr(TempA),".",DecToStr(TempB,2), $BA, "C",13,10)
end sub
// program start...
SetBaudrate(br115200)
SetPin(PORTC.0)
while true
DisplaySensor(Sensor_A)
DisplaySensor(Sensor_B)
delayms(1000)
wend