News:

Let's find out together what makes a PIC Tick!

Main Menu

Jumping code instructions

Started by Dave-S, Today at 01:30 PM

Previous topic - Next topic

Dave-S

Why is it not carrying some code instructions, it goes from the For/Next loop over serout commands to the setting of "Runonce = 1"
I was trying to add an additional carriage return after the For/next command but it does not do it, adding other serout cammands they just get ignored, and it gose to set "Runonce= 1".
This is the Output:
Main
Main
boot
Main
ATR
+GMR:"2.0.0 0 e41f977cb [16:31:26 Apr 12 2024]"
OK
>Main
Main

As you can see it puts the main on the line with ">"
Any ideas why the "SerOut PORTD.1, 84, ["End-CR", 13]" does not get carried out, or the other serouts when uncommerted?

Thanks David

code:
SerOut PORTD.1, 84, ["boot", 13]       
Main:
SerOut PORTD.1, 84, ["Main", 13]
 '******Run Once******************************************
If RunOnce = 0  Then
      Clear BatArray
      Bat_Pos = 0
      HSerOut2 ["AT+GMR", "\n", 13]   
    Repeat
         HSerIn2 6000, RtimeoutStat, [Bat_Char]
         BatArray[Bat_Pos] = Bat_Char
         Inc Bat_Pos
    Until  Bat_Pos = ">"       
    RtimeoutStat:       
    For L = 0 To 60
          SerOut PORTD.1, 84, [BatArray[L]]
    Next
   
    SerOut PORTD.1, 84, ["End-CR", 13]
    'SerOut PORTD.1, 84, [BatArray[0], BatArray[1], BatArray[2], BatArray[3], BatArray[4], BatArray[5], 13]
    'SerOut PORTD.1, 84, ["Str-9 ", Str BatArray\8, 13]

    RunOnce = 1 

EndIf
DelayMS 8000
GoTo Main

RGV250

Hi Dave,
I tried a bit of a simulation in VSM (could have been P-ICD) :)
It worked if i commented out the repeat / until so my only guess is that Bat_Pos is a number and being compared to a character? What happens if you use 62 (dec ASCII value of >)

Bob