1 Wire write - bit mode , no reset


+ Reply to Thread
Results 1 to 8 of 8

Thread: 1 Wire write - bit mode , no reset10 days old

  1. #1
    Junior Member RSteve's Avatar
    Join Date
    Aug 2008
    Posts
    15
    Thumbs Up
    Received: 1
    Given: 2
    Total Downloaded
    1.01 GB

    0 Not allowed!

    Default 1 Wire write - bit mode , no reset

    Hi All !
    I blew the dust off from an older project of mine, to find out that it no longer works...

    The problem is in this line - OWrite dq, 4, no_pres, [onebit]
    Always jumps to no_pres.
    I take a snippet from the two generated .asm files but i'm not good in ASM...maybe someone notice where is the problem.

    v 3.5.2.7
    the line with problem
    Code:
    F1_000250 equ $ ; IN [1W12F_DS1994.BAS] OWRITE DQ, 4, NO_PRES,[ONEBIT]
            movlw GPIO
            movwf GEN
            movlw 1
            movwf GENH
            movlw 4
            movwf GPR
            call [email protected]
            btfss STATUS,0
            goto no_pres
            movlw 0
            btfsc _B#VR1,5
            movlw 1
            call [email protected]
            call [email protected]
            btfss STATUS,0
            goto no_pres
    and the call routines...

    Code:
    [email protected]
            btfss 37,1
            goto [email protected]
            goto [email protected]
    [email protected]
            movwf 37
            btfss 37,0
            goto [email protected]
    [email protected]
            movf 32,W
            movwf 4
            movf 36,W
            xorlw 255
            andwf 0,F
            bsf 4,7
            andwf 0,F
            movlw 1
            movwf 40
            movlw 244
            call [email protected]
            movf 36,W
            iorwf 0,F
            movlw 100
            call [email protected]
            bcf 4,7
            movf 0,W
            andwf 36,W
            bcf 3,0
            skpz
            goto [email protected]
            movlw 1
            movwf 40
            movlw 144
            call [email protected]
    [email protected]
            setc
            goto [email protected]
    ....
    [email protected]
            bcf 3,7
    [email protected]
            bcf 3,5
            bcf 3,6
            return
    v 3.7.3.1
    the line with problem
    Code:
    F1_000250 equ $ ; IN [1W12F_DS1994.BAS] OWRITE DQ, 4, NO_PRES,[ONEBIT]
        movlw GPIO
        movwf GEN
        movlw 0X01
        movwf GENH
        movlw 0X04
        movwf GPR
        call __owreset2_
    ram_bank = 0
        btfss STATUS,0
        goto no_pres
        movlw 0X00
        btfsc _B#Vr1,5
        movlw 0X01
        call __owrite_
    ram_bank = 0
        call __owreset1_
    ram_bank = 0
        btfss STATUS,0
        goto no_pres
    and the call routines...

    Code:
    __owreset1_
        btfss GPR,1
        goto __Exit_Library__
        goto __owreset_
    __owreset2_
        movwf GPR
        btfss GPR,0
        goto __Exit_Library__
    __owreset_
        movf GEN,W
        movwf FSR
        movf GENH,W
        xorlw 255
        andwf INDF,F
        bsf FSR,7
        andwf INDF,F
        movlw 1
        movwf PP0H
        movlw 244
        call __delay_us_w_
        movf GENH,W
        iorwf INDF,F
        movlw 100
        call __delay_us_
        bcf FSR,7
        movf INDF,W
        andwf GENH,W
        bcf STATUS,0
        btfss STATUS,2
        goto __Exit_Library__
        movlw 1
        movwf PP0H
        movlw 144
        call __delay_us_w_
    __OWRESET_EXIT_
        bsf STATUS,0
        goto __Exit_Library__
    ....
    __Exit_Library__
    [email protected]
        bcf STATUS,7
        bcf STATUS,PP_RP0
        bcf STATUS,PP_RP1
        return
    Last edited by RSteve; 3rd November 2019 at 18:28. Reason: typo

Attention

This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

The advertisements we display are relevant to this web site and your browsing history

Please consider supporting us by disabling your ad blocker.


Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

If you can, please report issues in the forum area WebSite / Forum Issues


Thank you for your attention.

  • #2
    Prolific Poster charliecoultas's Avatar
    Join Date
    Sep 2010
    Posts
    1,347
    Thumbs Up
    Received: 42
    Given: 39
    Total Downloaded
    3.36 GB

    0 Not allowed!

    Default Re: 1 Wire write - bit mode , no reset

    Did you recompile it, and then it didn't work? If so, which version of the compiler did you use?

    Charlie

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #3
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    2,208
    Thumbs Up
    Received: 74
    Given: 180
    Total Downloaded
    5.15 GB

    0 Not allowed!

    Default Re: 1 Wire write - bit mode , no reset

    The problem is in this line - OWrite dq, 4, no_pres, [onebit]
    Are you sure you have the syntax correct? or maybe it's changed but according to the manual it's

    Owrite Pin, Mode, [ Outputdata ]

    where Pin = a pin of a port like PortA.2 (you probably have dq defined as)
    Mode = a number 0 thro 7 (you probably want 0 or 4)
    Outputdata = either byte or bit




    George.

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #4
    Junior Member RSteve's Avatar
    Join Date
    Aug 2008
    Posts
    15
    Thumbs Up
    Received: 1
    Given: 2
    Total Downloaded
    1.01 GB

    0 Not allowed!

    Default Re: 1 Wire write - bit mode , no reset

    Yes Charlie i recompiled with v 3.7.3.1 and did't work.
    Uninstalled the v 3.7.3.1, reinstalled the v 3.5.2.7 recompiled again and all working fine.
    I think George the syntax error is excluded since if compiled with 3.5.2.7 works fine programmed in a 12F683.
    Code:
    Device = 12F683
        
        Declare Reminders Off
        @ CONFIG_REQ = 0 ' Override Compiler's configuration settings
        Asm-
        __Config  0x3884 ' FOSC_INTOSCIO & WDTE_OFF & PWRTE_ON & MCLRE_OFF & CP_ON & CPD_OFF & BOREN_OFF & IESO_OFF & FCMEN_ON 
        Endasm-
        Declare Reminders On
        
        Declare All_Digital = true
        Xtal = 8
        OSCCON = $70        
        CMCON0 = 7         'comparators OFF                                    
        CMCON1 = 0
        ADCON0 = 0      'A/D converter OFF
        INTCON = 0       'INT's OFF
        ANSEL = 0
        VRCON = 0
        IOC = 0...
    
    Symbol dq = GPIO.0
    Dim onebit     As Bit
    Code:
    'Mode = 4 means No Reset, Bit mode
    ...
    
    


    Thanks for answering.
    Best regards,
    Steve


  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #5
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    2,208
    Thumbs Up
    Received: 74
    Given: 180
    Total Downloaded
    5.15 GB

    0 Not allowed!

    Default Re: 1 Wire write - bit mode , no reset

    I think George the syntax error is excluded since if compiled with 3.5.2.7 works fine programmed in a 12F683.
    I take your point, it's just the jump to no_pres (which is the mode) that threw me. I wondered if the syntax had changed.
    George.

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #6
    Junior Member RSteve's Avatar
    Join Date
    Aug 2008
    Posts
    15
    Thumbs Up
    Received: 1
    Given: 2
    Total Downloaded
    1.01 GB

    0 Not allowed!

    Default Re: 1 Wire write - bit mode , no reset

    That was my first thought to, but after reading the manual i realize nothing has changed for 1 wire communication.
    "When using the Bit (rather than Byte) mode of data transfer, all variables in the InputData argument
    will only receive one bit. For example, the following code could be used to receive two
    bits using this mode: -
    Dim BitVar1 as Bit
    Dim BitVar2 as Bit
    Owrite PORTA.0, 6, [BitVar1, BitVar2]
    In the example code shown, a value of 6 was chosen for Mode. This sets Bit transfer and Reset
    after data mode. We could also have chosen to make the BitVar1 and BitVar2 variables each a
    Byte type, however, they would still only use their lowest bit (Bit0) as the value to transmit in the
    Owrite command, due to the Mode value chosen.
    "
    The manual example works with reset after data - bit mode and i use no reset - bit mode.
    For checking if any iButton is present on reader i use reset before data - byte mode with instruction
    Code:
    OWrite dq, 1, no_pres, [$F0]       'Should reset and test for presence
    and allways continue without jumping to no_pres if i touch the iButton to the reader.
    The strange part for me was in the .asm file at
    Code:
    __owreset2_
        movwf GPR
        btfss GPR,0
        goto __Exit_Library__
    where it misses the
    Code:
    __OWRESET_EXIT_
        bsf STATUS,0
        goto __Exit_Library__
    ...
    __Exit_Library__
    [email protected]
        bcf STATUS,7
        bcf STATUS,PP_RP0
        bcf STATUS,PP_RP1
        return
    and goes to __Exit_Library__ skipping bsf STATUS,0...
    That's different in the two .asm files.
    In the old one (3.5.2.7)
    Code:
    [email protected]
            movwf 37
            btfss 37,0
            goto [email protected]
    where 37 representing the GPR, then
    and
    Code:
    [email protected]
            bcf 3,7
    [email protected]
            bcf 3,5
            bcf 3,6
            return
    where 3 is representing the STATUS, 5 is RP0 and 6 is RP1
    Thanks!
    Last edited by RSteve; 6th November 2019 at 17:16.

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #7
    Fanatical Contributor top204's Avatar
    Join Date
    Feb 2002
    Posts
    3,397
    Thumbs Up
    Received: 290
    Given: 141
    Total Downloaded
    1.68 GB

    0 Not allowed!

    Default Re: 1 Wire write - bit mode , no reset

    Many thanks for your detailed analysis of the problem RSteve.

    I'm inside the compiler now and looking for the section that has altered so I can correct it for the next update.

    I've also altered the compiler so that when the library is disabled with Declare Library_Core = Off, All the pre-mnemonics that run before the user's program starts are also disabled, so it leaves the user with a completely blank canvas. I did this because I have created a bootloader that can be written in the Proton language, but resides at the top of Flash memory. It is based upon the Tiny bootloader and works well with my first bootloader for a 18F26K40 device. As soon as I have some others, I'll upload them to my google drive for the users to alter for other devices etc...

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #8
    Junior Member RSteve's Avatar
    Join Date
    Aug 2008
    Posts
    15
    Thumbs Up
    Received: 1
    Given: 2
    Total Downloaded
    1.01 GB

    0 Not allowed!

    Default Re: 1 Wire write - bit mode , no reset

    Thank You Les, for everything !

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

    Thread Information

    Users Browsing this Thread

    There are currently 1 users browsing this thread. (0 members and 1 guests)

       

    Similar Threads

    1. LCD 4 Bit mode
      By pic-ignorant in forum The Lounge
      Replies: 10
      Last Post: 1st February 2012, 22:19
    2. [SOLVED !] HSEROUT running in 9 bit mode
      By Daniel in forum Serial / Ethernet
      Replies: 1
      Last Post: 31st March 2010, 22:26
    3. GLCD Write Mode
      By ~ Sy ~ in forum The Lounge
      Replies: 3
      Last Post: 18th August 2009, 12:28
    4. Bit bashed SPI slave mode
      By david in forum The Lounge
      Replies: 0
      Last Post: 27th September 2008, 11:32
    5. 8 bit result from 10 bit ADC using Left justification
      By Stephen Moss in forum Proton Plus Compiler v3
      Replies: 2
      Last Post: 11th July 2006, 14:15

    Members who have read this thread since 11th November 2019, 08:34 : 2

    Actions :  (Set Date)  (Clear Date)

    You do not have permission to view the list of names.

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts