Shop OBEX P1 Docs P2 Docs Learn Events
Download PropBASIC here... 00.01.14 LAST VERSION FOR BST - Page 16 — Parallax Forums

Download PropBASIC here... 00.01.14 LAST VERSION FOR BST

1131416181929

Comments

  • VonSzarvasVonSzarvas Posts: 3,450
    edited 2010-05-13 15:31
    I have attached some code which will not compile for me when I declare DATA in the TASK. If I move the DATA declaration out of TASK all is well.

    Might just be me!
  • VonSzarvasVonSzarvas Posts: 3,450
    edited 2010-05-13 15:34
    ..update...

    Tried the command line compile - It's ok.

    Might me a BST thing?
  • BeanBean Posts: 8,129
    edited 2010-05-13 16:41
    Maxwin,
    No, that is a problem with the compiler. Since the CON are declared in the main code it should NOT be putting the FISH# prefix in front of them.

    I'll get that fixed too.

    Bean

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Use BASIC on the Propeller with the speed of assembly language.
    PropBASIC thread http://forums.parallax.com/showthread.php?p=867134

    March 2010 Nuts and Volts article·http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/prop/col/nvp5.pdf
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    There are two rules in life:
    · 1) Never divulge all information
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    If you choose not to decide, you still have made a choice. [noparse][[/noparse]RUSH - Freewill]
  • VonSzarvasVonSzarvas Posts: 3,450
    edited 2010-05-13 18:44
    Bean, hold fire on that.

    If I add the TASK definition to that same sample code file it compiles ok. My fault.

    .. which is strange as the task definition was in my original code and that was failing--- but did I upgrade to the new PropBasic compiler in-between the two tests.. maybe..
    I will run some more tests and feedback if needed!
    Max.


    ' ----------------------------------------------------------------------
    ' TASK Definitions
    ' ----------------------------------------------------------------------
    
    FISH    TASK
    
    
  • VonSzarvasVonSzarvas Posts: 3,450
    edited 2010-05-13 19:11
    Bean, unhold the fire on that!!

    RHYME   DATA    "Jack be nimble",CR,LF,"Jack be quick",CR,LF,"Jack jump over",CR,LF,"the candlestick!",CR,LF,
    "Jack be nimble",CR,LF,"Jack be quick",CR,LF,"Jack jump over",CR,LF,"the candlestick!",CR,LF,0
    
    



    If you declare the above in the main program it compiles ok, but drop it into a task and the BST compiler will fail. (But the command line PropBasic compile is OK).

    When the spin "debug/error" file shows, it seems to suggest that the line is overflowing the maximum allowed for the 'compiler'. Perhaps (as you already mentioned) because of the inserted references to "FISH" making the line much longer.

    BST generated spin file
    BYTE "Jack be nimble",FISH#CR,FISH#LF,"Jack be quick",FISH#CR,FISH#LF,"Jack jump over",FISH#CR,FISH#LF,
    "the candlestick!",FISH#CR,FISH#LF,"Jack be nimble",FISH#CR,FISH#LF,"Jack be quick",FISH#CR,FISH#LF,
    "Jack jump over",FISH#CR,FISH#LF,"t
    
    



    As we can see the line overflows, and is left without closing the quote. (The line contains 238 chars/bytes)

    Appropriately the BST error message I see is: Error at (x,x) String missing ""

    I will split my DATA string in half for now as I can "afford" and extra SEROUT and PAUSE in this cog.

    Post Edited (Maxwin) : 5/13/2010 7:17:18 PM GMT
  • BeanBean Posts: 8,129
    edited 2010-05-13 19:56
    Maxwin,
    I just send BradC an update (version 00.00.97a) that should fix both of the problems you found.
    I'll update this thread title when Brad gets it posted.

    Bean

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Use BASIC on the Propeller with the speed of assembly language.
    PropBASIC thread http://forums.parallax.com/showthread.php?p=867134

    March 2010 Nuts and Volts article·http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/prop/col/nvp5.pdf
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    There are two rules in life:
    · 1) Never divulge all information
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    If you choose not to decide, you still have made a choice. [noparse][[/noparse]RUSH - Freewill]
  • BeanBean Posts: 8,129
    edited 2010-05-14 00:37
    Okay, Brad has posted version 00.00.97a so go get it.

    Maxwin,
    There are legitimate reason to have the same pin defined in more than one place. For example you may want one cog to communcate with another cog on a pin. Or you may want to monitor a pin in a cog that is an output in another cog.

    Bean

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Use BASIC on the Propeller with the speed of assembly language.
    PropBASIC thread http://forums.parallax.com/showthread.php?p=867134

    March 2010 Nuts and Volts article·http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/prop/col/nvp5.pdf
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    There are two rules in life:
    · 1) Never divulge all information
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    If you choose not to decide, you still have made a choice. [noparse][[/noparse]RUSH - Freewill]
  • SapiehaSapieha Posts: 2,964
    edited 2010-05-14 01:17
    Bean.

    THANKS for very nice Compiler.

    Regards
    Christoffer J

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Nothing is impossible, there are only different degrees of difficulty.
    For every stupid question there is at least one intelligent answer.
    Don't guess - ask instead.
    If you don't ask you won't know.
    If your gonna construct something, make it·as simple as·possible yet as versatile as posible.


    Sapieha
  • VonSzarvasVonSzarvas Posts: 3,450
    edited 2010-05-14 08:08
    Bean,

    Thank you for the update - version 97a fixes the DATA thing.

    I have an eyebrow raised about:
    There are legitimate reason to have the same pin defined in more than one place. 
    For example you may want one cog to communcate with another cog on a pin. 
    Or you may want to monitor a pin in a cog that is an output in another cog.
    
    




    Not tried yet, but I can imagine a PIN 1 HIGH/LOW in one cog could be detected by PIN 1 INPUT in another cog - might be very useful.

    BUT, without wanting to destroy a propeller, does anyone know would happen if PIN 1 HIGH in one cog and PIN 1 LOW in another cog. Do we see smoke ?

    Post Edited (Maxwin) : 5/14/2010 12:15:26 PM GMT
  • Christof Eb.Christof Eb. Posts: 1,197
    edited 2010-05-14 08:26
    Hi Maxwin,
    no smoke there. The outputs are "ored". High wins.
    Christof
  • VonSzarvasVonSzarvas Posts: 3,450
    edited 2010-05-14 08:44
    OK, Thank you Christof.
    I will proceed to experiment without the fear of fog!
  • RsadeikaRsadeika Posts: 3,837
    edited 2010-05-15 11:44
    I have a question about the usage of CR(13), and LF(10), as separate instructions. The way it is set up now, both drop down to the begging of a new line, when used separately. What I was expecting is CR(13) to go to the begging of the same line, and LF(10) to drop down a line.

    Ray
  • BeanBean Posts: 8,129
    edited 2010-05-15 11:51
    Ray,
    It depends on the terminal program.
    Some handle CR as goto beginning of SAME line, and some handle CR as goto beginning of NEXT line.
    The Parallax Serial Terminal program handle CR as goto beginning of the NEXT line.

    Bean

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Use BASIC on the Propeller with the speed of assembly language.
    PropBASIC thread http://forums.parallax.com/showthread.php?p=867134

    March 2010 Nuts and Volts article·http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/prop/col/nvp5.pdf
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    There are two rules in life:
    · 1) Never divulge all information
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    If you choose not to decide, you still have made a choice. [noparse][[/noparse]RUSH - Freewill]
  • RsadeikaRsadeika Posts: 3,837
    edited 2010-05-15 11:57
    I forgot to mention I was using the bst terminal program. I kind of like CR(13) to go back to the beginning of the SAME line, I guess I just got use to doing it that way.

    Ray
  • $WMc%$WMc% Posts: 1,884
    edited 2010-05-15 18:46
    Bean

    I updated my PropBasic compiler to the latest "bst.0.19.3" and "propBasic_bst" files. This didn't go so well. At anyrate I finally got it to work.I had to delete all of the old Propbasic stuff. And redownload the new stuff to make it work.

    My problem is I have lost all of my old programs(no biggie) But the "TEMPLATE" file is lost as well.

    Where can I find the "TEMPLATE" file for PorpBasic ?

    Before I did the update I was kicking butt with the PorpBasic compiler and the Prop chip.


    P.S. I think we need our own forum for PropBasic!!!!!!______Maybe replace the SX\B Forum, since the SX is nolonger in production.
    P.S.S. I'll send a request to the powers that be @ Parallax
    If anyone else thinks the same, Please E-Mail Parallax with your request

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The Truth is out there············___$WMc%___···························· BoogerWoods, FL. USA


    You can feel stupid by asking a stupid question or You can be really·stupid by not asking at all.

    Post Edited ($WMc%) : 5/16/2010 3:08:23 AM GMT
  • RsadeikaRsadeika Posts: 3,837
    edited 2010-05-15 19:05
    I believe when you use the 'New' command, in bst, you get a choice of two, for propBASIC, blank or template. I always use the blank, have not used the template yet.

    Ray
  • $WMc%$WMc% Posts: 1,884
    edited 2010-05-16 02:47
    Ray

    You are the man!

    I looked every were for that file,It was right under my nose the whole time.

    _______Thanks___

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The Truth is out there············___$WMc%___···························· BoogerWoods, FL. USA


    You can feel stupid by asking a stupid question or You can be really·stupid by not asking at all.

    Post Edited ($WMc%) : 5/16/2010 3:07:55 AM GMT
  • BradCBradC Posts: 2,601
    edited 2010-05-16 09:27
    Rsadeika said...
    I forgot to mention I was using the bst terminal program. I kind of like CR(13) to go back to the beginning of the SAME line, I guess I just got use to doing it that way.

    Making the terminal optionally emulate PST is on my list of stuff to do, but I got side tracked by the PropScope and a few other bits 'n bobs. Rest assure I *will* get to it.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "Are you suggesting coconuts migrate?"
  • VonSzarvasVonSzarvas Posts: 3,450
    edited 2010-05-16 10:02
    Somebody said...

    P.S. I think we need our own forum for PropBasic!!!!!!
    ______Maybe replace the SX\B Forum, since the SX is nolonger in production.

    I was thinking something similar, as this thread is getting a little long to navigate!

    I have noticed you can try to print the thread, at which the entire thread will come up on screen- then use the browser search facility (mine is CTRL F) to search for keywords.

    Not sure the answer is to ditch the SX/B thread - well not for a few more years any how!

    Opening new forums seems to fragment the propeller resources, so I think that should only be done if we can demonstrate a lot of propbasic questions. Which of course is tough when they are all in one thread!

    So from now on I propose posting my new PropBasic questions in the propeller forum, but using a subject prefix "PropBasic: "
    This might also make it simpler to move threads over to a new forum if it ever comes about, and should clearly demonstrate the propbasic "traffic". - Make finding already answered questions easier, etc.. etc..

    Of course, if this is a bad idea, please tell me!

    Cheers, Max.
    smile.gif
  • caskazcaskaz Posts: 957
    edited 2010-05-16 12:43
    Today I update to PropBASIC-bst-00.00.97a-64 and bst-0.19.3.
    There is compile-error "ERROR:UNKNOWN COMMAND "GETADDR".

    GETADDR form changed?
  • JonnyMacJonnyMac Posts: 9,104
    edited 2010-05-16 13:09
    Yes -- see 1st post in thread for updated docs (note title of thread includes indication of change to GETADDR).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon McPhalen
    Hollywood, CA
  • BeanBean Posts: 8,129
    edited 2010-05-16 13:24
    Caskaz,
    · Yes, in order to support strings, GETADDR was changed from a command to a function.
    Where before you did:

    GetAddr hubvar, longvar

    You will have to change the line to:

    longvar = GetAddr hubVar

    Bean

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Use BASIC on the Propeller with the speed of assembly language.
    PropBASIC thread http://forums.parallax.com/showthread.php?p=867134

    March 2010 Nuts and Volts article·http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/prop/col/nvp5.pdf
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    There are two rules in life:
    · 1) Never divulge all information
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    If you choose not to decide, you still have made a choice. [noparse][[/noparse]RUSH - Freewill]
  • BeanBean Posts: 8,129
    edited 2010-05-20 02:51
    Release 00.00.98 will support a new compiler directive: '{$CODE}

    This is used to make library LOAD files. In your LOAD file you will put the SUB and FUNC declaration at the top, then the '{$CODE} directive, then the actual code for the SUB/FUNC.

    When the compiler hits a LOAD command, it will only compile until it hits the '{$CODE} directive. Then when the program/task is finished, it automatically goes back and processes all the LOAD files again and compiles everything AFTER the '{$CODE} directive. This way libraries don't need to be in two seperate files.

    I also made some improvements/fixes to variable aliases that JonnyMac found.

    I started implementing 64 I/O pins, I hope this will be available in the future. P8X64A ??? The only restriction is that a pin group cannot span between the two sets of 32 pins.

    I still need some more testing, but it should be ready tomorrow.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Use BASIC on the Propeller with the speed of assembly language.
    PropBASIC thread http://forums.parallax.com/showthread.php?p=867134

    March 2010 Nuts and Volts article·http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/prop/col/nvp5.pdf
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    There are two rules in life:
    · 1) Never divulge all information
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    If you choose not to decide, you still have made a choice. [noparse][[/noparse]RUSH - Freewill]
  • Hank CarrHank Carr Posts: 22
    edited 2010-05-20 15:11
    Good morning.

    My name is Hank Carr and I'm a long time (30+ years) BASIC programmer who has just started using PropBASIC.· Nicely done.

    I am working (like so many other people) on using the Dallas DS18B20 thermometer.· I am currently using a PC104 based industrial computer with thermisters to control the heating system in my straw bale house.· I would like to replace it with a Propeller based controller using DS18B20s.· I've also got a project waiting to build an aquarium controller as well as some work for friends doing industrial automation.

    I spent some time searching for an implementation of·Search ROM in PropBASIC but couldn't find anything.· I then ported a PIC BASIC version I found on another forum and cleaned up the logic using the C from the DS18B20 data sheet.

    This is the result:

    '--------------------------------------------------------
    ' PropBASIC SearchROM
    '--------------------------------------------------------
    ' Ported from C and PIC BASIC by Hank Carr
    ' [url=mailto:hank@dna.ca]hank@dna.ca[/url]
    '--------------------------------------------------------
    DEVICE P8X32A, XTAL1, PLL16X
    FREQ 80_000_000
    Baud                    CON "T115200"
    DQPin                   PIN 16 INPUT    ' 1-Wire communication pin
    RX                      PIN 31 INPUT
    TX                      PIN 30 HIGH     ' Send data back to PC
    ID_Bit                  VAR LONG
    cmp_ID_Bit              VAR LONG
    LastDeviceFlag          VAR LONG         ' flag previous search was last device
    Search_Direction        VAR LONG         ' bit indicates direction of search.
    ID_Bit_Number           VAR LONG         ' The ROM bit number currently being searched
    LastDiscrepancy         VAR LONG         ' bit index from which bit (next)search
    LastFamilyDiscrepancy   VAR LONG         ' bit index identifies last discrepacy
    Last_Zero               VAR LONG         ' bit position of last zero written
    ROM_NO                  VAR LONG(8)      ' Current ROM number being searched
    tempROM_NO              VAR LONG
    ROM_Byte_Mask           VAR LONG
    ROM_Byte_Number         VAR LONG
    Conflict                SUB 0
    Family                  SUB 0
    '--------------------------------------------------------
    ' Jon McPhalen's TX formatting SUBs.
    '--------------------------------------------------------
    '
    ' [url=http://forums.parallax.com/showthread.php?p=907567]http://forums.parallax.com/showthread.php?p=907567[/url]
    '
    LOAD "tx_format_def.pbas"                ' formatting for SEROUT
    PROGRAM Start
      Start:
        LastFamilyDiscrepancy = 0
        LastDiscrepancy = 0
        LastDeviceFlag = 0
        last_zero = 0
      Banner:
        PAUSE 200
        TX_STR "1-wire Device Search"
        TX_BYTE CR
        TX_BYTE CR
      Device_loop:
        PAUSE 100
        OWRESET DQPin ' Reset the 1-wire bus
        IF LastDeviceFlag = 1 THEN Done
        ID_Bit_Number = 1
        Last_Zero = 0
        ROM_Byte_Mask = 1
        ROM_Byte_Number = 0
        OWWRITE DQPin, $F0 ' Send the Searc ROM command
      Check_bit:
        OWREAD DQPin, ID_Bit\1
        OWREAD DQPin, cmp_ID_Bit\1
        IF ID_Bit = 1 AND
          cmp_ID_Bit = 1 THEN No_Device
        IF ID_Bit = 1 OR
          cmp_ID_Bit = 1 THEN
          Search_Direction = ID_Bit
          tempROM_NO = ROM_NO(ROM_Byte_Number)
          IF Search_Direction = 1 THEN
            tempROM_NO = tempROM_NO OR ROM_Byte_Mask
          ELSE
            tempROM_NO = tempROM_NO ANDN ROM_Byte_Mask
          ENDIF
          ROM_NO(ROM_Byte_Number) = tempROM_NO
        ENDIF
        IF ID_Bit = 0 AND
          cmp_ID_Bit = 0 THEN
          GOSUB Conflict
        ENDIF
        OWWRITE DQPin, Search_Direction\1
        INC ID_Bit_Number
        ROM_Byte_Mask = ROM_Byte_Mask << 1
        IF ROM_Byte_Mask > 128 THEN
            ROM_Byte_Mask = 1
            INC ROM_Byte_Number
        ENDIF
        IF ID_Bit_Number <= 64 THEN Check_bit
        IF ID_Bit_Number > 64 THEN
          LastDiscrepancy = Last_Zero
        ENDIF
        IF LastDiscrepancy = 0 THEN
          LastDeviceFlag = 1
        ENDIF
        TX_STR "Type: "
        TX_HEX ROM_NO(0),2
        TX_BYTE CR
        TX_STR "ID:   "
        TX_HEX ROM_NO(6),2
        TX_HEX ROM_NO(5),2
        TX_HEX ROM_NO(4),2
        TX_HEX ROM_NO(3),2
        TX_HEX ROM_NO(2),2
        TX_HEX ROM_NO(1),2
        TX_BYTE CR
        TX_STR "CRC:  "
        TX_HEX ROM_NO(7),2
        TX_BYTE CR
        IF LastDeviceFlag = 0 THEN
            GOTO Device_Loop
        ENDIF
        GOTO Done
    END
    No_Device:
      TX_STR "No device."
    END
    Done:
        LastFamilyDiscrepancy = 0
        LastDiscrepancy = 0
        LastDeviceFlag = 0
        TX_BYTE CR
        TX_STR "Done"
        TX_BYTE CR
    END
    SUB Conflict
        IF ID_Bit_Number = LastDiscrepancy THEN
            Search_Direction = 1
            tempROM_NO = ROM_NO(ROM_Byte_Number)
            IF Search_Direction = 1 THEN
              tempROM_NO = tempROM_NO OR ROM_Byte_Mask
            ELSE
              tempROM_NO = tempROM_NO ANDN ROM_Byte_Mask
            ENDIF
            ROM_NO(ROM_Byte_Number) = tempROM_NO
        ENDIF
        IF ID_Bit_Number > LastDiscrepancy THEN
            Search_Direction = 0
            tempROM_NO = ROM_NO(ROM_Byte_Number)
            IF Search_Direction = 1 THEN
              tempROM_NO = tempROM_NO OR ROM_Byte_Mask
            ELSE
              tempROM_NO = tempROM_NO ANDN ROM_Byte_Mask
            ENDIF
            ROM_NO(ROM_Byte_Number) = tempROM_NO
            GOSUB Family
        ENDIF
        IF ID_Bit_Number < LastDiscrepancy THEN
            Search_Direction = ROM_NO(ROM_Byte_Number) AND ROM_Byte_Mask
            IF Search_Direction = 0 THEN
                GOSUB Family
            ENDIF
        ENDIF
    ENDSUB
    SUB Family
        Last_Zero = ID_Bit_Number
        IF Last_Zero < 9 THEN
            LastFamilyDiscrepancy = Last_Zero
        ENDIF
    ENDSUB
    '--------------------------------------------------------
    ' Jon McPhalen's TX formatting SUBs.
    '--------------------------------------------------------
    '
    ' [url=http://forums.parallax.com/showthread.php?p=907567]http://forums.parallax.com/showthread.php?p=907567[/url]
    '
    LOAD "tx_format_inc.pbas"
     
    

    I hope someone finds it useful.

    I've got a question.· I have been trying to use the Match ROM command to address my DS18B20s.· The command would look something like this:

    $55280000027CB1D54644

    where $55 is the Match ROM command, $28 is the Family Code for the DS18B20, $0000027CB1D5 is the Serial Number of the DS18B20 I'm using, $46 is the CRC, and $44 is the Convert Temperature command.· This is an 80 bit command and for the life of me I can't figure out how to send 80 bits to the 1-wire bus.· I've tried breaking it up into chunks and sending it out a chunk at a time but that doesn't work.

    Can someone kick me in the right direction?

    Thanks,

    Hank
    hank@dna.ca

    P.S.· I couldn't find a reference to logical NOT anywhere in the manual or the Syntax Guide.· H.
    ·
  • BeanBean Posts: 8,129
    edited 2010-05-20 15:31
    Hank,
    There is a very simple DS18B20 program in the demos zip file available from the first post in this thread. It sends a couple 16 bit commands.

    Oh, and the logical NOT is the ~ operator. value = ~value

    Bean

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Use BASIC on the Propeller with the speed of assembly language.
    PropBASIC thread http://forums.parallax.com/showthread.php?p=867134

    March 2010 Nuts and Volts article·http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/prop/col/nvp5.pdf
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    There are two rules in life:
    · 1) Never divulge all information
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    If you choose not to decide, you still have made a choice. [noparse][[/noparse]RUSH - Freewill]
  • Hank CarrHank Carr Posts: 22
    edited 2010-05-20 15:34
    Thanks, Bean.

    I have used the simple DS18B20 program in the demos and it works well.· As ar as I can tell, though, it only allows me to access a single DS18B20.· I would like to be able to select the DS18B20 that I'm addressing on a multi-drop 1-wire bus which may include other DS18B20s as well as other 1-wire devices.· I think that requires me to send the full 64bit ROM address of the DS18B20 I'm trying to talk to and that's what I'm having problems with.

    Hank.
  • Hank CarrHank Carr Posts: 22
    edited 2010-05-20 17:30
    Here is what my 1-wire bus looks like:

    6ds18b20s.jpg

    That is six DS18B20s.· When I run the SearchROM program it reports this:

    1-wire Device Search

    Type: 28
    ID:·· 0000027C85A0
    CRC:· AE
    Type: 28
    ID:·· 0000027C76B0
    CRC:· 1D
    Type: 28
    ID:·· 0000027CCE64
    CRC:· 74
    Type: 28
    ID:·· 00000106FF1A
    CRC:· E1
    Type: 28
    ID:·· 0000027CCE66
    CRC:· 74
    Type: 28
    ID:···0000027CB1D5
    CRC:· 46
    Type

    All done


    I then want to take that info and plug it into your DS18B20 demo program to read the temperature from one of the six·DS18B20s connected to the bus.

    I've tried this:
    [color=#000000]OWWRITE DQPin, $55280000027CB1D54644[/color]
    
    

    ·and this:
    [color=#000000]OWWRITE DQPin, $55280000027CB1D54644\80[/color]
    
    

    ·and this:
    [color=#000000]    OWRESET DQPin[/color]
     
    [color=#000000]    OWWRITE DQPin, $55\8[/color]
    [color=#000000]    OWWRITE DQPin, $28000002\32[/color]
    [color=#000000]    OWWRITE DQPin, $7CB1D546\32[/color]
    [color=#000000]    OWWRITE DQPin, $44\8[/color]
     
    [color=#000000]    PAUSE 750           ' Wait for conversion[/color]
     
    [color=#000000]    ' Read temperature value[/color]
     
    [color=#000000]    OWRESET DQPin[/color]
     
    [color=#000000]    OWWRITE DQPin, $55\8[/color]
    [color=#000000]    OWWRITE DQPin, $28000002\32[/color]
    [color=#000000]    OWWRITE DQPin, $7CB1D546\32[/color]
    [color=#000000]    OWWRITE DQPin, $BE\8  ' ReadROM[/color]
     
    [color=#000000]    OWREAD DQPin, value\16[/color]
    
    

    It either tells me that it is an invalid numeric representation or that I have a constant over 32 bits, or in the case of the third example it simply doesn't work.

    In a real world application it is likely that there will be a mix of 1-wire devices on a 1-wire bus.· In my house controller for example there will be a DS18B20 for inside air temperature, outside air temperature, supply water temperature, and return water temperature, a couple of·humidity sensors, and a 1-wire enabled high temperature thermistor.
    ·
    Ideally, once the controller is installed and running I would like to be able to plug in a sensor and select "scan the 1-wire bus" from the menu.· It would report that it found a new device and ask me what it is based on the family code (which of the four DS18B20s or the two sumidity sensors and it would know that the thermistor was the thermistor).· I could then add another sensor and repeat the process until all sensors are connected.· If one goes bad I could replace it then rescan the bus.· It would report that one was missing but that it found a new one and ask if I wanted to replace the old one with the new one.
    ·
    What I'm wondering is how I send the full ROM command to the 1-wire bus.· I can't figure it out.

    Thanks for your help.

    Hank.


  • Shawn LoweShawn Lowe Posts: 635
    edited 2010-05-20 21:21
    Hank- Try:



    OWRESET DQPin
    OWWRITE DQPin, $55
    OWWRITE DQPin, $2800
    OWWRITE DQPin, $0002
    OWWRITE DQPin, $7CB1
    OWWRITE DQPin, $D546
    OWWRITE DQPin, $44
     
    etc...
    

    It's the same thing you had, just try breaking it into word sized packets. I believe the \16 is optional. Just guessing here, if you can read their ROM codes you should be able to get a temp from one of them.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Shawn Lowe


    When all else fails.....procrastinate!
  • Hank CarrHank Carr Posts: 22
    edited 2010-05-20 23:44
    Shawn,

    Thanks for the suggestion.· I actually took the DS18B20 demo program and changed the line:
    OWWRITE DQPin, $BECC\16
    

    to:
    OWWRITE DQPin, $BE\8
    OWWRITE DQPin, $CC\8
    

    to see if it worked and it didn't.

    I'm not sure if it is a timing issue or if there is a stop bit or something but it sends the bus high.

    PIC BASIC lets you do it like this:
    [b]OWOUT [/b]DQ, 1, [noparse][[/noparse]$55,$28,$C1,$03,$23,$00,$00,$00,$00,$BE]
    
    

    I'm stumped.

    Hank.
    ·
  • JonnyMacJonnyMac Posts: 9,104
    edited 2010-05-21 04:06
    You should be able to put the serial number into a DATA table and then iterate through it.

    For example:

    SUB OW_WRITE_SN
    
      snOut         VAR     __param1
      snAddr        VAR     __param3
      snIdx         VAR     __param4
    
      snAddr = __param1                             ' save address
    
      FOR snIdx = 0 TO 7
        RDBYTE snAddr, snOut      
        OWWRITE DQ, snOut     
        INC snAddr      
      NEXT
    
      ENDSUB
    


    You'll have to pass the address of the DATA table to this routine.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon McPhalen
    Hollywood, CA

    Post Edited (JonnyMac) : 5/21/2010 4:11:19 AM GMT
Sign In or Register to comment.