changing a whole port bit at a time

Kecked

Member
I am using max335 spi switches for a music sequencer. I want to add some leds to show the channel that is on. I can't just tap the channel as the voltage changes from zero to 10v so I was thinking of using an 18m2 that reads the CS and advances as the CS is addressed.

Here is what I had in mind:

Code:
dirsC=%00000000
dirsb=%11111111
b1=%00000001
main:
If pinC.0=1 and pinc.1=1 then goto seq: 
if pinC.0=0 then goto Main:


seq:

if b1=%00000000 then let b1=%00000001
	endif
	let pinsb=b1
	b1=b1*2
	
	

goto main
The idea is that when DIN(C.1) and CS(C.0) both see data the sequence advances. IE I'm looking to decode the spi on the 18m2 to set the port and mimic the channel on the leds

Do you think I can just read the DIN line and CS and set a variable that defines the port pin status? IE simulated SPI?
 

Kecked

Member
I decided to try using the spi on a separate chip to drive the leds. I can't seem to make the sclk not be an output. I just hooked up the spi lines sclk, din, cs to the max chip I want to mimic. All i want to do is read the data off the din line into a variable to set the status of a port to light the leds. Here is what I did
Code:
#picaxe 20x2


let dirsB = %11111111
let adcsetup = 0

main:

hspisetup spimode00,spifast
hspiin (b0)
let pinsC=b0


goto main
 

hippy

Technical Support
Staff member
I may be missing something but why not just add a 74HC595 or whatever to read the SPI data and drive the LED's ?
 
Top