Shop OBEX P1 Docs P2 Docs Learn Events
TSL220 problem — Parallax Forums

TSL220 problem

Buck RogersBuck Rogers Posts: 2,178
edited 2010-10-13 09:43 in BASIC Stamp
Hello!
I have this program running on a BS2:
' {$STAMP BS2}
' {$PBASIC 2.5}

' TSL230R-Test.bs2
' Configures TSL230R for x10 sensitivity
' Displays output in Debug Terminal
'-----Define variables, set status of pins-----
x VAR Word
cnt VAR Word
'-----Constant declarations------
S0 PIN 0 'Sensitivity selection pins
S1 PIN 1
In PIN 2 'TSL230R output pin
'-----Program Start-----
LOW S0 'Set sensitivity pins (S0,S1) to x10
HIGH S1
'-----Main program loop-----
FOR x = 0 TO 255
'PULSOUT 5,1
COUNT In, 100, cnt 'COUNT on P2 FOR 100 ms, store value in cnt
DEBUG DEC cnt, CR 'Display value of cnt as a decimal
DEBUG DEC x, CR
SEROUT 3, 396, [cnt]
PAUSE 125
SEROUT 4, 396, [x]
PAUSE 250
PULSOUT 5,2
NEXT
END

It started out as the example named above from the PDFs distributed with the device. I then added those other lines to communicate with logic connected to the stamp. In this first case (first case since updating my power supply problems, see http://forums.parallax.com/showthread.php?t=126196 .)

the idea was to have the flip flop, an SN74H72 respond to the events enclosed in the program. And while the debug window is shown.

However when the program is run it promptly sets the flip flop to the Q state, rather then toggling between the Q and not Q ones. I have P3 connected to the J1 input and P4 connected to the K1 input. The clock is derived from the stream created from the pulse out instruction on 5. That particular one is called a "SN7472 AND-Gated J-K Master-Slave Flip-Flop with Preset and Clear"

Its been obsolete for a while now, but I have enough here of it, and the SN74H70, which is called "SN7470 AND-Gated J-K Positive-Edge-Triggered Flip-Flop with Preset and Clear" for most of these runs.

The two are functionally related.

Ideally the debug should have enabled me to see the data that the TSL220 was seeing--And the F/F should have been toggling at the same time.

Now it is.:confused:

It happens that's what I was working on when those events linked to it, happened.
Sign In or Register to comment.