Shop OBEX P1 Docs P2 Docs Learn Events
Smartpins and edge events — Parallax Forums

Smartpins and edge events

Chip
Currently we check the INx bit of the relevant smartpin to evaluate the status of the pin.
This can be done simply with TESTB and also can be captured by the streamer.
We also have the SETEDG instruction which is very nice but appears to not work with smartpins.
It would be useful to setup a smartpin as a async receiver and generate an interrupt when data is available.

Was connecting the edge detector logic to smartpins too costly in logic and/or too complex?
Just curious. :)

Comments

  • cgraceycgracey Posts: 14,209
    It works! You just need to be sure that IN is lowered via PINACK before it can go high again and trigger an edge event. The whole idea was to allow interrupts. I'm thinking that I'll add one more edge event/interrupt, so that we can be responsive to more than one smart pin.
  • ozpropdevozpropdev Posts: 2,793
    edited 2016-04-21 11:02
    Doh! <:(
    Forgot PINACK
    Thanks Chip.
    con
    	sys_clk = 80_000_000
    	baudrate = 115_200
    	nco_baud = round(float($1_0000) / (float(sys_clk) / float(baudrate)))
    	rx_pin = 63
    
    dat		org
    
    		or	dirb,#$ff
    
    		pinsetm	#%0_11111_0,#rx_pin
    		pinsetx	##$8000_0000 | nco_baud << 16 | %1_00000 | 7,#rx_pin
    		setb	dira+rx_pin>>5,#rx_pin
    
    		mov	ijmp1,#rx_isr
    		setedg	#%01_000000 | rx_pin
    		setint1	#5 'edge event
    here		jmp	#here
    
    rx_isr		pingetz	adra,#rx_pin
    		pinack	#rx_pin
    		setbyte	outb,adra,#0
    		reti1
    
    
Sign In or Register to comment.