controlling interference
mike_1234
Posts: 21
Does anyone have suggestions as to how to control emf fields?
My stamp has 13 inputs, (just reading if a switch is·high or low) is there anyway i can
prevent the other inputs from picking up the status of the other inputs
thanks
Mike
My stamp has 13 inputs, (just reading if a switch is·high or low) is there anyway i can
prevent the other inputs from picking up the status of the other inputs
thanks
Mike
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
'{$STAMP BS2pe}
'{$PBASIC 2.5}
RD_E2PROM_Switch PIN 14
Input_Pins_0_13 VAR INS
Value_To_Store VAR Nib
Stored_Value VAR Nib
WR_E2PROM_Addr VAR Word
RD_E2PROM_Addr VAR Word
Initialize:
WR_E2PROM_Addr = 0
INPUT RD_E2PROM_Switch
DO
GOSUB Chk_Inputs
LOOP
END
Chk_Inputs:
PAUSE 100
IF (Input_Pins_0_13 <> 0) THEN GOSUB Convert_Decimal '<> means NOT EQUAL
IF (RD_E2PROM_Switch = 1) THEN GOSUB RD_E2PROM
RETURN
Convert_Decimal:
IF (Input_Pins_0_13 = 1) THEN
Value_To_Store = 0
GOSUB WR_E2PROM
ENDIF
IF (Input_Pins_0_13 = 2) THEN
Value_To_Store = 1
GOSUB WR_E2PROM
ENDIF
IF (Input_Pins_0_13 = 4) THEN
Value_To_Store = 2
GOSUB WR_E2PROM
ENDIF
IF (Input_Pins_0_13 = 8) THEN
Value_To_Store = 3
GOSUB WR_E2PROM
ENDIF
IF (Input_Pins_0_13 = 16) THEN
Value_To_Store = 4
GOSUB WR_E2PROM
ENDIF
IF (Input_Pins_0_13 = 32) THEN
Value_To_Store = 5
GOSUB WR_E2PROM
ENDIF
IF (Input_Pins_0_13 = 64) THEN
Value_To_Store = 6
GOSUB WR_E2PROM
ENDIF
IF (Input_Pins_0_13 = 128 ) THEN
Value_To_Store = 7
GOSUB WR_E2PROM
ENDIF
IF (Input_Pins_0_13 = 256) THEN
Value_To_Store = 8
GOSUB WR_E2PROM
ENDIF
IF (Input_Pins_0_13 = 512) THEN
Value_To_Store = 9
GOSUB WR_E2PROM
ENDIF
IF (Input_Pins_0_13 = 1024) THEN
Value_To_Store = 10
GOSUB WR_E2PROM
ENDIF
IF (Input_Pins_0_13 = 2048) THEN
Value_To_Store = 11
GOSUB WR_E2PROM
ENDIF
IF (Input_Pins_0_13 = 4096) THEN
Value_To_Store = 12
GOSUB WR_E2PROM
ENDIF
IF (Input_Pins_0_13 = 8192) THEN
Value_To_Store = 13
GOSUB WR_E2PROM
ENDIF
RETURN
WR_E2PROM:
STORE 8
WRITE WR_E2PROM_Addr, Value_To_Store
WR_E2PROM_ADDR = WR_E2PROM_Addr + 1
RETURN
RD_E2PROM:
STORE 8
DEBUG "E2PROM CONTENTS", CR, CR
FOR RD_E2PROM_Addr = 0 TO WR_E2PROM_Addr
READ RD_E2PROM_Addr, Stored_Value
GOSUB Send_To_Display
NEXT
RETURN
Send_To_Display:
DEBUG "Location ", DEC RD_E2PROM_Addr, " = ", DEC Stored_Value, CR
RETURN
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
http://forums.parallax.com/showthread.php?p=554164
And also some information on maximum switch distance and some alternative switch strategies in this thread:
http://forums.parallax.com/showthread.php?p=556608
Hope that helps!
Vern
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔