help me


+ Reply to Thread
Results 1 to 2 of 2

Thread: help me3455 days old

  1. #1
    Junior Member cassio_franquini's Avatar
    Join Date
    Aug 2010
    Posts
    7
    Thumbs Up
    Received: 0
    Given: 0
    Total Downloaded
    1.16 GB

    0 Not allowed!

    Default help me

    Hello to all ...

    I can not communicate with the rs232 apparently the error is related to communication time see the code below:

    Device 16F877A
    Config HS_OSC , WDT_OFF , PWRTE_OFF , BODEN_OFF , LVP_OFF , PWRTE_OFF , CP_OFF , DEBUG_OFF
    XTAL 20
    REMARKS On
    RSOUT_PACE 50000
    Declare
    serial

    ADCON1=%00000110 'TODAS AS PORTAS DIGITAIS
    OPTION_REG.7=1 'DESABILITA PULL-UP DA PORTA B
    OPTION_REG.3 = %1 'DIRECIONA O PRESCALER PARA O WATCHDOG
    OPTION_REG.2 = %1 'AJUSTA PRESCALER
    OPTION_REG.1 = %1 'AJUSTA PRESCALER
    OPTION_REG.0 = %1 'AJUSTA PRESCALER

    TRISA = %00000000
    TRISB = %00100001
    TRISC = %10001111
    TRISD = %00000010
    INTCON = %00000000


    Symbol AMM =
    PORTA.0
    Symbol VRD =
    PORTA.1
    Symbol VRM =
    PORTA.2

    Symbol INT =
    PORTB.0
    Symbol LED_1 =
    PORTB.1
    Symbol LED_2 =
    PORTB.2
    Symbol LED_3 =
    PORTB.3
    Symbol LED_4 =
    PORTB.4
    Symbol RXD_ETH =
    PORTB.5
    Symbol TXD_ETH =
    PORTB.6

    Symbol PROG =
    PORTC.0
    Symbol YES =
    PORTC.1
    Symbol NO =
    PORTC.2
    Symbol TAMPER =
    PORTC.3
    Symbol STAT_2 =
    PORTC.4
    Symbol STAT_3 =
    PORTC.5
    Symbol STAT_4 =
    PORTC.6
    Symbol RX_CRTL =
    PORTC.7

    Symbol TXD_RS =
    PORTD.0
    Symbol RXD_RS =
    PORTD.1
    Symbol DIAG =
    PORTD.2
    Symbol STAT_1 =
    PORTD.3
    Symbol RL_1 =
    PORTD.4
    Symbol RL_2 =
    PORTD.5
    Symbol RL_3 =
    PORTD.6
    Symbol RL_4 =
    PORTD.7

    Dim COD As Byte
    Dim
    X As Byte
    Dim
    TP As Byte
    Dim
    ADDRESS As Word
    Dim CODI As Byte
    Dim
    MENUITEM As Byte
    Dim
    PONTEIRO As Byte
    Dim
    A As Byte
    Dim
    B As Byte
    Dim
    STATLED As Byte
    Dim
    CONTROLE[6] As Word
    Dim
    FLAG As Bit
    teste:
    For A = 1 To 10
    Set
    PORTB
    DelayMS 100
    Low
    PORTB
    DelayMS 100
    Next A
    MENUITEM = 0
    SerOut DIAG,16468,[126,1,1,
    "INICIALIZANDO."]
    DelayMS 300
    inicializa:
    PONTEIRO = 0
    B = 1
    PONTEIRO = ERead 0
    If PONTEIRO > 11 Then GoTo inicio
    For A = 1 To PONTEIRO Step 2
    CONTROLE[B] = ERead A
    B=B+1
    Next A

    inicio:

    ETHERNET:

    Set
    PORTB.1
    X = X + 1
    SerOut
    PORTD.2,16468 ,[126,1 , 1,"time-out ",Dec X ]
    DelayUS 10
    SerIn
    PORTB.5,16468,100,ETHERNET,[Wait("#UNI"),COD] '9600 16468 84

    SerOut
    PORTD.2,16468 ,[126,1 , 1," ok ",DEC3 COD," " ]
    DelayMS 3000
    SerOut
    PORTD.2,16468 ,[126,0 , 0,0]
    'If cod=255 Then GoSub STT
    If COD=011 Then PORTB.1 = 1 : PORTB.2 = 0 : PORTB.3 = 0
    If COD=022 Then
    PORTB.1 = 0 : PORTB.2 = 1 : PORTB.3 = 0
    If COD=033 Then
    PORTB.1 = 0 : PORTB.2 = 0 : PORTB.3 = 1
    If COD=044 Then
    PORTB.1 = 1 : PORTB.2 = 1 : PORTB.3 = 0
    If COD=055 Then
    PORTB.1 = 1 : PORTB.2 = 0 : PORTB.3 = 1
    If COD=066 Then
    PORTB.1 = 0 : PORTB.2 = 1 : PORTB.3 = 1
    If COD=077 Then
    PORTB.1 = 1 : PORTB.2 = 1 : PORTB.3 = 1
    If COD=100 Then
    PORTB.1 = 0 : PORTB.2 = 0 : PORTB.3 = 0
    'DelayMS 20
    'If cod=123 Then SerOut PORTB.6,16468,[">> ",DEC5 evt]
    'If cod=124 Then evt=0
    'If cod=136 Then GoSub desliga
    'If cod=124 Then GoSub voltamemo
    STATLED = 0
    LED_1 =
    PORTD.4
    LED_2 =
    PORTD.5
    LED_3 =
    PORTD.6
    GoTo ETHERNET


    Serin PORTB.5, 16468.100, ETHERNET, [Wait ("# UNI") COD]
    var cod always returns a value = 255

    Thank you very much



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 C_Moore's Avatar
    Join Date
    Sep 2004
    Posts
    1,393
    Thumbs Up
    Received: 2
    Given: 0
    Total Downloaded
    704.59 MB

    0 Not allowed!

    Default Re: help me

    Try clearing the vars before you use them. So put COD = 0 after you declare it.
    Regards
    Charlie M.

  • 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)

       

    Tags for this Thread

    Posting Permissions

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