Yes, specifically bit 7..0 of the instruction/register (which happens to hold the source parameter). For your small fragment it's probably better to use separate register variables. It's not that you need the space.
Conveniently everything you have in a cog is registers ...
I did have a nice long explanation on what my other cogs were doing. When i went to post it, I was redirected to sign in again, Fail. The page never loaded and I just lost about 30mins of typing. Here is the short version.
(1) the cog I'm currently working on.
(2) data input cog, 8 inputs, via shift reg and optoisolators. updates every 3.5uS (PASM)
(3) Data Output cog, 8 outputs, via shift reg and relays. updates every 0.3mS (SPIN)
(4) Data logging Cog,w/ serial input(5), SD Card driver(6). receives serial data every 50mS, currently using up ~25mS processing data and writing it to the sd card, waiting/wasting the rest.
(7) Quadrature Encoder driver, reads data byte from Data input cog(Spin), encoder channels A and B limited to 2.75Khz each(Because of SPIN).
(8) Data processing, used for some math and standard deviation calculations, responsible for setting alarm conditions and also in charge of a LCD display.
At least for me there is a lot going on there, once i get the system running as a whole I'll be a little more willing to consolidate cogs.
I'm currently stuck again though, it appears the Propeller Tool doesn't like a few of my jmp addresses. It States there undefined when they are, I'm sure that there is something I'm missing. Maybe you or Marko, may be willing to lend a hand.
Problem is that there is a global label in the way (_two). You try to jump to the local label :testAlarm which is behind said global label and therefore not visible. Simply change _two to :two. It's a scope thing.
Comments
Conveniently everything you have in a cog is registers ...
Thanks Again.
What do you have in the other cogs? Maybe they could be combined simply???
I did have a nice long explanation on what my other cogs were doing. When i went to post it, I was redirected to sign in again, Fail. The page never loaded and I just lost about 30mins of typing. Here is the short version.
(1) the cog I'm currently working on.
(2) data input cog, 8 inputs, via shift reg and optoisolators. updates every 3.5uS (PASM)
(3) Data Output cog, 8 outputs, via shift reg and relays. updates every 0.3mS (SPIN)
(4) Data logging Cog,w/ serial input(5), SD Card driver(6). receives serial data every 50mS, currently using up ~25mS processing data and writing it to the sd card, waiting/wasting the rest.
(7) Quadrature Encoder driver, reads data byte from Data input cog(Spin), encoder channels A and B limited to 2.75Khz each(Because of SPIN).
(8) Data processing, used for some math and standard deviation calculations, responsible for setting alarm conditions and also in charge of a LCD display.
At least for me there is a lot going on there, once i get the system running as a whole I'll be a little more willing to consolidate cogs.
I'm currently stuck again though, it appears the Propeller Tool doesn't like a few of my jmp addresses. It States there undefined when they are, I'm sure that there is something I'm missing. Maybe you or Marko, may be willing to lend a hand.
Here's my current code:
_clkmode = xtal1 + pll16x _xinfreq = 5_000_000 ' _xinfreq = 6_250_000 'Control Constants UltraUBufferSize = 20 maxSD = 14 OutputTime = (80_000_000 / 1000) * 100 'Output Asignments CutDisableMsk = %1000_0000 BlowOffMsk = %0010_0000 CounterDisableMsk = %0100_0000 Alarm1Msk = %0000_0010 Alarm2Msk = %0000_0001 'Input Asignments EnableMsk = %1000_0000 CutSigMsk = %0100_0000 KnifeProxMsk = %0010_0000 CutPosProxMsk = %0001_0000 ResetMsk = %0000_0001 EncAMsk = %0000_1000 EncBMsk = %0000_0100 EncCMsk = %0000_0001 var Long LengthBuffer Long LogLength Long ErrorBuffer Long StandardDeviation Long CycleTime[2] word BufferPool[UltraUBufferSize] byte BufferCnt Byte UltraUBufferLock Byte I2CLock Byte CogCnt Byte Status Byte RLYOutput Byte DataIn obj lcd : "lcd4Bit" Sonic : "UltraU_Stream" BLOBJ : "Buff_Loader_OBJ2" DigO : "IO_Board_Output_Driver" DigI : "IO_Board_Input_Driver_PASM" Encoder : "Encoder_Driver" dat Version byte "6.00", 0 Str0 byte " ", 0 Str1 byte " P-CAM ", 0 Str2 byte " Modual ", 0 Str3 byte "Booting ", 0 Str4 byte "Lcd Drv ", 0 Str5 byte "SonicDrv", 0 Str6 byte " In Drv ", 0 str7 byte "Out Drv ", 0 str8 byte "Enc Drv ", 0 str9 Byte "RUNNING ", 0 str10 byte " STOPPED", 0 str11 byte " ", 0 str12 byte "UNSTABLE", 0 str13 byte "SD calc ", 0 Pass Byte "Success.", 0 Fail Byte " Fail ", 0 Pub main 'bootup UltraUBufferLock := LockNew IF lcd.init(8,8,2) lcd.blon lcd.scrollstr(1, 1, 8, 100, @str1) lcd.rscrollstr(1, 2, 8, 100, @str2) waitcnt(cnt + clkfreq / 2) lcd.moveto(1,2) lcd.str(string("Ver#")) lcd.str(@Version) waitcnt(cnt+clkfreq/2) lcd.moveto(1,1) lcd.str(@str3) lcd.moveto(1,2) lcd.str(@Str5) waitcnt(cnt + (clkfreq / 1000 * 500)) IF Sonic.Start(31,30,@BufferPool,@BufferCnt,@LengthBuffer,@LogLength,@ErrorBuffer,@CycleTime,UltraUBufferSize,UltraUBufferLock,EnableMsk,KnifeProxMsk,CutPosProxMsk,@Status,@DataIn) lcd.moveto(1,2) lcd.str(@Str6) waitcnt(cnt + (clkfreq / 1000 * 500)) if DigI.Start(@DataIn) lcd.moveto(1,2) lcd.str(@str7) waitcnt(cnt + (clkfreq / 1000 * 500)) if DigO.Start(@RLYOutput) lcd.moveto(1,2) lcd.str(@str8) waitcnt(cnt + (clkfreq / 1000 * 500)) if Encoder.Start(EncAMsk,EncBMsk,EncCMsk,@LengthBuffer,@ErrorBuffer,@DataIn) lcd.moveto(1,2) lcd.str(@str13) waitcnt(cnt + (clkfreq / 1000 * 500)) if BLOBJ.Start(@DataIn, @BufferPool,@ErrorBuffer,@RLYOutput,@Status,EnableMsk,ResetMsk,CutDisableMsk,Alarm1Msk,Alarm2Msk,MaxSD,UltraUBufferSize) lcd.moveto(1,2) lcd.str(@Pass) lcd.finalize 'sort Coginit(CogID,@sort,@lengthBuffer) else lcd.moveto(1,1) lcd.str(@fail) reboot else lcd.moveto(1,1) lcd.str(@fail) reboot else lcd.moveto(1,1) lcd.str(@Fail) reboot else lcd.moveto(1,1) lcd.str(@Fail) reboot else lcd.moveto(1,1) lcd.str(@Fail) Reboot else Reboot Dat org 0 sort add LengthBuffer_, par add LogLength_, par add CycleTime_, par add Status_, par add RLYOutput_, par add DataIn_, par mov BlowOffDisable, #0 mov ErrorSkip, #0 _one mov frqa, #1 movi ctra, #%0_11111_000 ' LOGIC always :loop :waitCutSig rdbyte tmp, DataIn_ test tmp, #CutSigMsk wz if_z jmp #:waitCutSig mov phsa,#0 rdbyte tmp, RLYOutput_ test tmp, #CutdisableMsk wz if_z jmp #:testAlarm 'Propeller Tool Doesn't like this address. rdbyte tmp, RLYOutput_ or tmp, #CounterDisableMsk wrbyte tmp, RLYOutput_ mov BlowOffDisable, #2 rdbyte tmp, status_ _two cmp tmp, #2 wz if_ne wrbyte _one, status_ mov ErrorSkip, #1 :testAlarm rdbyte tmp, RLYOutput_ test tmp, #Alarm2Msk wz if_nz jmp #:CheckCutPos rdbyte tmp, RLYOutput_ or tmp, #Alarm1Msk or tmp, #CounterDisableMsk wrbyte tmp, RLYOutput_ wrbyte _two, status_ mov BlowOffDisable,#3 mov errorSkip, #1 :CheckCutPos rdbyte tmp, datain_ test tmp, #CutPosProxMsk wz if_z jmp #:testAlarm 'Propeller Tool Doesn't like this address. :CheckSkip cmp errorSkip, #0 if_ne jmp #:DecrementErrorSkip mov tmp, phsa wrlong tmp, cycletime_ rdlong tmp, LengthBuffer_ wrlong par, LengthBuffer_ 'zero length buffer wrlong tmp, LogLength_ :CheckStopProx rdbyte tmp, DataIn_ test tmp, #KnifeProxMsk wz if_z jmp #:CheckStopProx mov tmp, cycleTime_ add tmp, #4 mov tmp1, phsa wrlong tmp1, tmp jmp #:BlowOff :DecrementErrorSkip sub errorSkip, #1 :BlowOff cmp BlowOffDisable, #0 wz if_ne jmp #:DecrementBlowOffDis rdbyte tmp, RLYOutput_ or tmp, #BlowOffMsk wrbyte tmp, RLYOutput_ mov tmp, outtime add tmp, cnt waitcnt tmp, #0 rdbyte tmp, RLYOutput_ xor tmp, #BlowOffMsk wrbyte tmp, RLYOutput_ :DecrementBlowOffDis sub BlowOffDisable, #1 rdbyte tmp, RLYOutput_ test tmp, #CounterdisableMsk wz if_nz cmp BlowoffDisable, #0 wz if_e xor tmp, CounterDisableMsk if_e wrbyte tmp, RLYOutput_ jmp #:loop 'Or this address!!!! '***************************************************************** LengthBuffer_ long 0 LogLength_ long 4 CycleTime_ long 16 Status_ long 27 RLYOutput_ long 28 DataIn_ long 29 outtime long outputTime tmp res 1 tmp1 res 1 BlowOffDisable res 1 ErrorSkip res 1Man your on your guns. Thanks.