Can a smart pin receive and buffer serial data ?
Bean
Posts: 8,129
Looking at the smart pin modes it looks like it can receive a single character.
Is there a way to use the streamer to automatically store more characters ?
Or must you use an interrupt ?
Thanks,
Bean
P.S. Happy Thanksgiving to all.
Is there a way to use the streamer to automatically store more characters ?
Or must you use an interrupt ?
Thanks,
Bean
P.S. Happy Thanksgiving to all.

Comments
For small stuff like key presses, polling works fine. For bulk data, it's either set it up for temporary burst or dedicate a whole cog like the original full-duplex-serial. Msrobots has done one of the latter already.
Or you can try interrupts.
Thanks for the help,
Bean
If it's any help this is what I use in TAQOZ for serial. While the serial receive interrupts and buffers characters, I find it is easier to transmit without buffering because this is a far more efficient way at high speeds. I think I've tested mine up to about 12Mbd.
'#######################################################################' ' serial.p2a '#######################################################################' InitSerial drvh #tx_pin wrpin #$7C,#tx_pin ' asynchronous transmit wrpin #$3E,#rx_pin ' asynchronous receive 'SETBAUD ' calculate baud timing at runtime' rdlong r0,#@_CPUHZ rdlong r1,#@_BAUD qdiv r0,r1 getqx r0 shl r0,#16 add r0,#7 ' 8 data bits ' wxpin r0,#rx_pin ' baud 8 data wxpin r0,#tx_pin ' baud 8 data wypin #$0D,#tx_pin rdlong PTRA,#@_TERMINAL dirh #rx_pin ' enable smartpin mode' rdpin rxz,#rx_pin wc ' clear rx? setint1 #0 ' disable int0' mov rxwrC,#0 wrlong rxwrC,#@rxrd setse1 #%110<<6+rx_pin ' set se1 to trigger on rx char event????? mov ijmp1,##@taqoz_rxisr ' set int1 jump vector to receive buffer setint1 #4 ' Enable int0 to trigger on se1' ret ' ( SERIAL RECEIVE INTERRUPT SERVICE ROUTINE )' taqoz_rxisr shl rxlong,#8 rdpin rxz,#rx_pin ' recv byte (bits31:24) from rx pin shr rxz,#24 ' right justify' or rxlong,rxz wz ' update history word' cmp rxlong,##$1B1B1B1B wz ' check for sequence' if_z coginit #0,#0 ''@_RESET ' force reset ' cmp rxlong,##$1A1A1A1A wz ' check for sequence ' if_z decod rxz,#28 ' reboot via hub' if_z hubset rxz mov rxwrP,rxwrC ' update write pointer' add rxwrP,##rxbuffers wrbyte rxz,rxwrP ' write char to buffer' wrbyte rxz,#@lastkey ' write directly to global variable in low hub' incmod rxwrC,##rxsize-1 ' update write index' wrword rxwrC,#@rxwr ' update write index in hub' reti1CONEMIT or tos,stopbits TXR1 mov txpin,#tx_pin wypin tos,txpin '..send byte waitx #0 .wait testp txpin wc '..wait for buffer empty if_nc jmp #.wait jmp #DROP txpin long tx_pin stopbits long $FFFF_FF00Thanks that helps a lot.
Bean
P.S. Can you explain the line "rdlong PTRA,#@_TERMINAL" ?