Using Shift-Out from SX28 to Shift-In on SX48
John Bond
Posts: 369
Hi Guys
·
PLEASE HELP!!!
·
I am trying to pass a byte from an SX28 to an SX48 development board using the Shift-Out and Shift-In commands. I can’t get it to work.
·
What am I doing wrong…
·
·
From>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
DEVICE········· SX28, OSC4MHZ, TURBO, STACKX, OPTIONX
FREQ··········· 4_000_000
·
Dpin·········· VAR···· RA.0·········· ' shift data
Cpin·········· VAR···· RA.1·········· ' shift clock
Latch········· VAR···· RA.2·········· ' latch outputs
LED······ ··· ·VAR· RB.0
·
temp1········· VAR···· Byte
ShiftChar····· VAR···· Byte
·
watch counter, 8, udec
·
' ====================================================
· PROGRAM Start
' ====================================================
·
'
' Subroutine Declarations
'
ShiftItOut········· SUB···· 1········ ' pass value out
·
Start:
ShiftChar = 123
·
TRIS_B = %00000000
·
Main:
·
··· ShiftItout ShiftChar ···' transfer data
break··································
·
·
···· toggle LED
···· pause 20
·
GOTO main
·
·
ShiftItout:
· temp1 = __PARAM1····· ··········' capture value
· SHIFTOUT Dpin, Cpin, 0, temp1·· ' send the bits
· PULSOUT Latch, 2·············· ·' transfer to outputs
· RETURN
·
·
·
To>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
DEVICE········· SX48, OSC4MHZ,
FREQ··········· 4_000_000
·
·
Dpin··········· VAR···· RA.1····· ' shift data
Cpin··········· VAR···· RA.2····· ' shift clock
Latch·········· VAR···· RA.3····· ' latch outputs
·
temp1·········· VAR···· Byte
·
·
watch temp1, 8, udec
·
' ===================================================
· PROGRAM Start
' ===================================================\
Start:
·
TRIS_A = %11111111
·
Main:
·
SHIFTIN DPin, CPin, 0, temp1
break··································
·
GOTO main
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·
PLEASE HELP!!!
·
I am trying to pass a byte from an SX28 to an SX48 development board using the Shift-Out and Shift-In commands. I can’t get it to work.
·
What am I doing wrong…
·
·
From>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
DEVICE········· SX28, OSC4MHZ, TURBO, STACKX, OPTIONX
FREQ··········· 4_000_000
·
Dpin·········· VAR···· RA.0·········· ' shift data
Cpin·········· VAR···· RA.1·········· ' shift clock
Latch········· VAR···· RA.2·········· ' latch outputs
LED······ ··· ·VAR· RB.0
·
temp1········· VAR···· Byte
ShiftChar····· VAR···· Byte
·
watch counter, 8, udec
·
' ====================================================
· PROGRAM Start
' ====================================================
·
'
' Subroutine Declarations
'
ShiftItOut········· SUB···· 1········ ' pass value out
·
Start:
ShiftChar = 123
·
TRIS_B = %00000000
·
Main:
·
··· ShiftItout ShiftChar ···' transfer data
break··································
·
·
···· toggle LED
···· pause 20
·
GOTO main
·
·
ShiftItout:
· temp1 = __PARAM1····· ··········' capture value
· SHIFTOUT Dpin, Cpin, 0, temp1·· ' send the bits
· PULSOUT Latch, 2·············· ·' transfer to outputs
· RETURN
·
·
·
To>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
DEVICE········· SX48, OSC4MHZ,
FREQ··········· 4_000_000
·
·
Dpin··········· VAR···· RA.1····· ' shift data
Cpin··········· VAR···· RA.2····· ' shift clock
Latch·········· VAR···· RA.3····· ' latch outputs
·
temp1·········· VAR···· Byte
·
·
watch temp1, 8, udec
·
' ===================================================
· PROGRAM Start
' ===================================================\
Start:
·
TRIS_A = %11111111
·
Main:
·
SHIFTIN DPin, CPin, 0, temp1
break··································
·
GOTO main
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Comments
not generate the clock. The clock is generated by the shiftOut.
The SX/B shiftIn is only master. You probably need a VP written in assembly,
but perhaps someone has a SX/B version of a SPI slave.
Go to
http://www.sxlist.com/techref/ubicom/virtperf.htm
and scroll down to SX to SX spi interface
regards peter
So my options seem to be:
- Get a slave spi or write one (I'm not keen to write one, i also only work in SX/B)
- Use a UART (seems overkill for 1 byte)
- Write my own proprietry shift register
Kind regards from the Dark Continent
John Bond
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Just send the value using SEROUT and SERIN instead of SHIFTOUT and SHIFTIN.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap used 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
SX-Video Display Modules www.sxvm.com
Stuff I'm selling on ebay http://search.ebay.com/_W0QQsassZhittconsultingQQhtZ-1
"USA Today has come out with a new survey - apparently, three out of every four people make up 75% of the population." - David Letterman
- That also means wne the system expands, I can have a single sender and many receivers and use 2 bytes, 1 to identify the address and the 2nd as the control byte...
You know, I am fast asleep today.
John Bond
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔