Switching on/off high speed serial functionality 28X1

kranenborg

Senior Member
Hello,

I have a few questions I could use some help with:

In my application using a number of 28X1 chips (beta SerialPower V4) I will use the HSerin/Hserout pins intermittently for high-speed serial operations (HSERSETUP baudrate, %00000011 ... HSERSETUP OFF) as well as the Hserin pin as a standard input pin (In7) for detecting a change via a serial interrupt and the Hserout pin at a well-defined state. This also means that after the HSERSETUP OFF command the state of both these pins must be well defined. My questions then are:

- If not in high-speed serial mode, is it sufficient for setting the output state of the C port via the HIGH/LOW PORTC command only, or is the LET DIRSC command always necessary first to define C port pins as outputs?
- If LET DIRSC is also necessary, can I first define the output state and then use LET DIRSC instead of the other way around?
- Does the HSERSETUP OFF command leave the corresponding pins always as inputs, or does their state then revert to the latest setting (input or output Hiigh or output Low) just before the high speed serial operation was enabled?

Thanks!

/Jurjen
 
Last edited:

hippy

Technical Support
Staff member
- If not in high-speed serial mode, is it sufficient for setting the output state of the C port via the HIGH/LOW PORTC command only, or is the LET DIRSC command always necessary first to define C port pins as outputs?

Just the HIGH/LOW PORTC will be sufficient; that sets desired output level and makes the pin an output.

- If LET DIRSC is also necessary, can I first define the output state and then use LET DIRSC instead of the other way around?

If a pin is an input, LET PINSC will set the desired output state, which will become the output state immediately when a LET DIRSC sets the pin as an output.


- Does the HSERSETUP OFF command leave the corresponding pins always as inputs, or does their state then revert to the latest setting (input or output Hiigh or output Low) just before the high speed serial operation was enabled?

HSERSETUP OFF will leave TX and RX as inputs. LET DIRSC will return the outputs to the levels previously set by LET PINSC.

Code:
At Reset          TRISC = 1111 1111
Set as Outputs    TRISC = 0000 0000
HSerSetup         TRISC = 1000 0000
HserSetup Off     TRISC = 1100 0000
Set as Outputs    TRISC = 0000 0000
Code:
#Picaxe 28X1
#No_Data
#No_Table
#Terminal 4800

Pause 1000                : SerTxd( "At Reset", 9 )    : Gosub Dump
pinsC = $FF : dirsC = $FF : SerTxd( "Set as Outputs" ) : Gosub Dump
HSerSetup B9600_4, %000   : SerTxd( "HSerSetup" )      : Gosub Dump
HSerSetup Off             : SerTxd( "HserSetup Off" )  : Gosub Dump
dirsC = $FF               : SerTxd( "Set as Outputs" ) : Gosub Dump

Do : Loop

Dump:
  Peek $87, b0 ' Read TRISC
  SerTxd( 9, "TRISC = " )
  SerTxd( #bit7, #bit6, #bit5, #bit4, " "    )
  SerTxd( #bit3, #bit2, #bit1, #bit0, CR, LF )
  Return
 
Top