Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Junebug bug w/ USART?

Status
Not open for further replies.
Just a thought!!
maybe something to do with timing seeing how Pommies code uses the OW.bas and the first code uses the DS18B20.bas
first code used an 18F452 w/ clock = 20
the second code uses the OW.bas, an 18F1320 at 8mhz. The code seems to work BUT the conversion is off
As far as hardware, am using only the Junebugs 1320 PIC
will give your new code a fling Burt
 
It dosn't display on the USART tool.
even tried changing the baud rate in code and USART tool.
going to invistigate further by looking at the comparision between the ds18b20.bas and the ow.bas
if it was hardware why does one code actually work using the ow.bas but the conversion is off.
looking at the ds18b20 data sheet and wonder if the code is reading the 12 bit binary correctly?
10.125 c = 0000000010100010
how to display the byte in binary using the usart just for information purposes and maybe find the problem w/ conversion
 
the first code does not use the OW.bas. You missed the // (in my trial and errors I leave code as is but add //. In this case I added the OW.bas and then // disabled it.
Been fiddeling w/ the code that works using only the OW.bas
The code starts out right in cool water(need to make some ice but lost the recipe) but then it tells me I have 120F temperature after inserting in under my tongue.
I notice the red LED on the Junebug flashes with the OW.bas but not the DS18B20 .bas???
with 120 temperature I must be in hell---LOL
 
LOL it's there you just haven't learn how to use the ide
its-here-jpg.54537
 

Attachments

  • It's here.jpg
    It's here.jpg
    57.2 KB · Views: 260
Well blow me down, learn something every day--THANKS
Tempted to go w/ store-bought PID but I want the satisfaction of I BUILT IT
Beginning to think maybe going w/ a thermocouple? but the DS18B20 is accurate
Going to get my 18F4520 board with the PRG/USART switch out and look at using a 18F4520 instead of the 1320
The 1320 is working but the temps are wayyy outta wack
Getting ready to wave a white flag
 
Just a thought!
Maybe the code is reading all 16 bits where only 12 are to be read?
Not up on how to determine.
 
The whole problem is here
Code:
 If  not DS18B20.Find  Then
       USART.Write("No device found", 13, 10)
   Else

I don't have a DS18B20 so the statement is false

This code works I'm sure of that
Code:
// 18F1320 @ 8MHz - they are just used here for clarity...
Device = 18F1220
Clock = 8
Config OSC=INTIO2
// import modules...
Include "INTOSC8"
Include "DS18B20.bas"
Include "convert.bas"
Include "Utils"
Include "usart.bas"
// working variables...
Dim 
   TempA As ShortInt,
   TempB As Word
   
// program start...
ADCON1 = $7f //all digital
TRISA.3=0 //A3 output
PORTA.3=1 //and high
USART.SetBaudrate(br9600)
DS18B20.SetPin(PORTA.4)

// Find() will search the bus for a single DS1820 device
// and load its ROM ID into the DS1820 public variable RomID - you
// could do this manually. For example, RomID = MyRomID...
While true
  DelayMS(100)
   If  not DS18B20.Find  Then
       USART.Write("No device found", 13, 10)
   Else
  DelayMS(1000)
     While true
        DS18B20.Convert
        DS18B20.GetTemp(TempA, TempB)
        USART.Write(DecToStr(TempA),".",DecToStr(TempB,4), $BA, "C", 13, 10)
        DelayMS(1000)
      Wend
   EndIf
Wend

hook it up like this and see if she works LOL
ds18b20-png.54551
 

Attachments

  • ds18b20.png
    ds18b20.png
    5.1 KB · Views: 292
Last edited:
This should work with the LCD
Code:
// 18F1320 @ 8MHz - they are just used here for clarity...
Device = 18F1220
Clock = 8
Config OSC=INTIO2
#option LCD_DATA = PORTB.4
#option LCD_RS = PORTB.0
#option LCD_EN = PORTB.1
// import modules...
Include "INTOSC8"
Include "DS18B20.bas"
Include "LCD.bas"
Include "convert.bas"
Include "Utils"

// working variables...
Dim 
   TempA As ShortInt,
   TempB As Word
   
// program start...
ADCON1 = $7f //all digital
TRISA.3=0 //A3 output
PORTA.3=1 //and high
DS18B20.SetPin(PORTA.4)
DelayMS (500)
LCD.Cls

// Find() will search the bus for a single DS1820 device
// and load its ROM ID into the DS1820 public variable RomID - you
// could do this manually. For example, RomID = MyRomID...
While true
  DelayMS(100)
   If  Not DS18B20.Find  Then
       WriteAt(1,1,"No device found")
   Else
  DelayMS(1000)
     While true
        DS18B20.Convert
        DS18B20.GetTemp(TempA, TempB)
        LCD.MoveCursor (2,1)
        LCD.Write(DecToStr(TempA),".",DecToStr(TempB,4))
        DelayMS(1000)
      Wend
   EndIf
Wend
 
Will give it a go tomorrow
My LOML is taking me to dinner but while waiting until 4:30 rolls around I have been assembling my no nonsense PIC dev board.
Looking good just hope it works. It is using a 40pin PIC. I want to verify if the link that you know who posted actualy works. I am having doubts.
Oh yea HAPPY FATHERS DAY!!!
 
I just tested this with a LCD It works the problem before was convert it's being used two times and caused the loop to end in error

Code:
// 18F1320 @ 8MHz - they are just used here for clarity...
Device = 18F1220
Clock = 8
Config OSC=INTIO2
#option LCD_DATA = PORTB.4
#option LCD_RS = PORTB.0
#option LCD_EN = PORTB.1
// import modules...
Include "INTOSC8"
Include "DS18B20.bas"
Include "LCD.bas"
Include "convert.bas"
Include "Utils"

// working variables...
Dim 
   TempA As ShortInt,
   TempB As Word
   
// program start...
ADCON1 = $7f //all digital
TRISA.3=0 //A3 output
PORTA.3=1 //and high
DS18B20.SetPin(PORTA.4)
DelayMS (500)
LCD.Cls

// Find() will search the bus for a single DS1820 device
// and load its ROM ID into the DS1820 public variable RomID - you
// could do this manually. For example, RomID = MyRomID...
While true
  DelayMS(100)
   If  Not DS18B20.Find  Then
       WriteAt(1,1,"No device found")
       WriteAt(2,1,"We need One")
   Else
  DelayMS(1000)
     While true
        DS18B20.Convert
        DS18B20.GetTemp(TempA, TempB)
        LCD.MoveCursor (2,1)
        LCD.Write(DecToStr(TempA),".C ",DecToStr(TempB),".C ")
        DelayMS(1000)
      Wend
   EndIf
Wend
 
Last edited:
I don't know why you would not use a DS18S20 It's made for temp control
 
Well they have an accuracy to .5C
I will probably just go w/ a store bought PID if I can't get this dang thing working.
Been busy welding my recumbent bike together then this evening been assembling a PIC-40 DEV board with selector switch for USART or PRG.
We don't need no claptrap software to reset usart pins.
I see over at that other site there are issues with the software usart.
 
The DS18S20 you can set it to keep you at a middle temp which is what most pid controller do

This is kind of funny to me I repair all kinds of things from car heater controls out of high dollar cars to door openers. I wire houses that could do any thing but wipe you LOL. I all ways Loved Electronics been fulling with computers from almost the first home Computers . Made my first one in 1989 As my wife said I been wasting my time for over 27 years LOL fulling with Electronics. So i know a little about this world

I lost my job about 5 years ago so my hobby has took over to micro world pic stamps ARM tell what i know on here and about 5 more places

I'm going to say this as a Friend MrDeb you can cook that egg to the prefect state of 140 a lot easier then what you wanting to do
5 gallons of water takes a long time to heat a long time to cool a simple on at 139 and of at 141 would keep you in the middle 140

That's what pid would do just figure the variables
 
There is absolutely no difference in the accuracy of the DS18S20 and the DS18B20. They are both accurate to 0.5ºC.

Mike.
 
There is absolutely no difference in the accuracy of the DS18S20 and the DS18B20. They are both accurate to 0.5ºC.

Mike.

That's what I read to the DS18S20 just let's you set a high and low which I think would make it easy to rig a big pot of water up and keep it with in a narrow range of temperature

Now if we where steering a boat or controlling a motor Pid would be the best bet but cooking eggs and meat in a big pot water things are going to happen so
slow I could keep it at 1 degree celcius just watching it LOL and i'm old and slow lol
 
Last edited:
Come August 27th there is a Beef cook-off contest. This has become a competition between myself and my LOML. I plan to WIN this year. Have placed every year I have entered (LOML WON the first time we entered).
Have seen several websites that have this cooking method described. This one has a nice looking set-up https://seattlefoodgeek.com/2010/02/diy-sous-vide-heating-immersion-circulator-for-about-75/ but for $75 I think I can do better cost wise.
Plan to use a 1440watt Hot water tank element, a pump, and PID controller (home-built would be cheaper and more sataisfyting. Using the DS18B20 if I read all the 12 bits for temp, then the temp will display down to .065 instead of .5
 
Perhaps it would be better if you did your own coding then. Then you know what you have and don't have to worry about the claptraps.

.
We don't need no claptrap software to reset usart pins.
I see over at that other site there are issues with the software usart.
 
Actually I wounder dose any one ever look at the samples. There real helpful
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top