Hello. I have the following basic stamp code:
Since it is not fully compatible, I've modified faults VAR Nib to faults VAR Byte, and also, instead of "DEBUG", I'm using LCDOUT.Code:' {$STAMP BS2} ' {$PBASIC 2.5} MXCS PIN 0 MXSO PIN 1 MXSCLK PIN 2 degCouple VAR Word degCinternal VAR Word TCtemp1 VAR Word TCtemp0 VAR Word faults VAR Nib SCVfault VAR faults.BIT2 SCGfault VAR faults.BIT1 OCfault VAR faults.BIT0 DO LOW MXCS 'chip select low SHIFTIN MXSO, MXSCLK, MSBPRE, [TCtemp1\16,TCtemp0\16] 'shift in the data HIGH MXCS 'chip select high degCouple = TCtemp1 >> 2 + (-TCtemp1.BIT15 << 14) ' the last term extends the sign bit degCinternal = TCtemp0 >> 4 + (-TCtemp0.BIT15 << 12) faults = TCtemp0.NIB0 degCouple = (TCtemp1 >> 2) / 4 DEBUG SDEC degCouple, TAB, SDEC degCinternal, TAB, BIN3 faults PAUSE 1000 DEBUG CLS LOOP
Still does not works, returns 0 instead of temperature. When same hardware connected to BS2, the code works properly. Pinout seems to be correct. What else can be reason?




Bookmarks