crgwbr
01-29-2007, 08:09 PM
This problem has stumped me for about a week, I finally decided to post it here to see if you can figure it out.· I'm in the middle of implementing a PINK module with the Propeller.· My program reads an encoder, does some calculations with the reading, then assigns it to a variable in the PINK.· This is the Display Loop protion of my code:
PUB Display_Loop····································· ······ ······· ''Display_Loop
waitcnt(80_000_000 + cnt)···························· ········· 'Wait 1 Second
Work_Var[5] := FM.FDiv(Enc1, 108)··························· 'Divide Encoder Reading by 108
Work_Var[6] := FS.FloatToString(Work_Var[5])· ·········· 'Convert Answer to String
·
if Enc1 < 0················································· ············ 'If Encoder Reading is less than Zero
· Serial.Str(string("!NB0W01:Tool Above Zero Plane"))···· 'Assign Pink Variable 01: Tool Above Zero Plane
· Serial.tx(CLS)···································· ·················· ·'Finalize Variable Change
··
else·············································· ························ 'If Encoder Reading is 0 or Greater
· Serial.Str(string("!NB0W01:"))·································· 'Assign Pink Variable 01: Work_Var[6]
· Serial.Str(Work_Var[6])····························
· Serial.tx(CLS)···································· ··················· 'Finalize Variable Change
Display_Loop······································ ·····················'Loop Back to Beginning
This Code should wait 1 second, do some math, make a desision, assign a variable, then repeat.· But for some reason, it isn't waiting at waitcnt like it should be.· This is causeing the pink to be blasted with serial information so fast that it can not make sense of it.· Anyone have An Idea of why it's doing this?
Thanks,
crgwbr
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
NerdMaster
For
Life
PUB Display_Loop····································· ······ ······· ''Display_Loop
waitcnt(80_000_000 + cnt)···························· ········· 'Wait 1 Second
Work_Var[5] := FM.FDiv(Enc1, 108)··························· 'Divide Encoder Reading by 108
Work_Var[6] := FS.FloatToString(Work_Var[5])· ·········· 'Convert Answer to String
·
if Enc1 < 0················································· ············ 'If Encoder Reading is less than Zero
· Serial.Str(string("!NB0W01:Tool Above Zero Plane"))···· 'Assign Pink Variable 01: Tool Above Zero Plane
· Serial.tx(CLS)···································· ·················· ·'Finalize Variable Change
··
else·············································· ························ 'If Encoder Reading is 0 or Greater
· Serial.Str(string("!NB0W01:"))·································· 'Assign Pink Variable 01: Work_Var[6]
· Serial.Str(Work_Var[6])····························
· Serial.tx(CLS)···································· ··················· 'Finalize Variable Change
Display_Loop······································ ·····················'Loop Back to Beginning
This Code should wait 1 second, do some math, make a desision, assign a variable, then repeat.· But for some reason, it isn't waiting at waitcnt like it should be.· This is causeing the pink to be blasted with serial information so fast that it can not make sense of it.· Anyone have An Idea of why it's doing this?
Thanks,
crgwbr
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
NerdMaster
For
Life