Struggling with simple thing
HighwayRob
Posts: 5
I am struggling with a simple thing. I am using the FullDuplexSerial Debugger.
The PC[index] variable in the code segment below does not appear to get incremented when I use the ++. The ser.dec(PC[index],1) always displays zero.
Is this an issue with the FullDuplex deugger program?
Is this a valid way of doing this? Really odd, is that it seems to work when the FullDuplex program is not used! I was using the fullduplex program to verify all is good.
I need 18 accumulators to do some counting if an alarm is detected. I would rather not create 18 separate variables and use a CASE statement, but I will if I have to.
VAR
Byte PC[17] 'Byte array for the Wait Counter of the Alarm Delay
'Here is the problematic code
if AS == ina[index] ' and If Alarm is on
if PC[index] <= AD
PC[index]++
ser.tx(13)
ser.str(string("incremented PC = "))
ser.dec(PC[index],1)
else
PC[index]:=0 ' otherwise reset to zero
ser.tx(13)
ser.str(string("zeroed PC"))
The PC[index] variable in the code segment below does not appear to get incremented when I use the ++. The ser.dec(PC[index],1) always displays zero.
Is this an issue with the FullDuplex deugger program?
Is this a valid way of doing this? Really odd, is that it seems to work when the FullDuplex program is not used! I was using the fullduplex program to verify all is good.
I need 18 accumulators to do some counting if an alarm is detected. I would rather not create 18 separate variables and use a CASE statement, but I will if I have to.
VAR
Byte PC[17] 'Byte array for the Wait Counter of the Alarm Delay
'Here is the problematic code
if AS == ina[index] ' and If Alarm is on
if PC[index] <= AD
PC[index]++
ser.tx(13)
ser.str(string("incremented PC = "))
ser.dec(PC[index],1)
else
PC[index]:=0 ' otherwise reset to zero
ser.tx(13)
ser.str(string("zeroed PC"))
Comments
The "++" operator works and FullDuplexSerial works, so it must be something else.
You show the call to "ser.dec(PC[index],1)" which will not compile since ser.dec takes only a single argument, so I'm not sure what your actual code looks like. This is another reason why you need to post your actual code.
if PC[index] =< AD
Andy