Andres Rodriguez
New Member
Iam trying to use hspiin command to read data from a MAX6675 ADC chip. I modified Peter anderson's code to replace the bit banging portion of his code. When I run the simulation I am geting 0 values for b0 and b1. The code is as follows:
Any suggestions?
Code:
'MAX6675_1.Bas - PICAXE 28X1
' Define terminal associated with MAX6674 / 6675
' PICAXE 28X1 MAX6674 / 6675
' CS (OUT3) ----Chip Select---- CS (term 6)
' SCK (OUT4) ------Clock------- SCK (term 5)
' SI (IN7) -Serial out from MAX- SO (term 7)
Symbol CS = Output3
Symbol SCK = OutPut5
Symbol SI = Input1
Symbol Val = W0
Symbol WholePart = W1
Symbol FractPart = B4
Symbol Diga = B5
Symbol N = B6
TOP:
GoSub MeasTemp
GoSub DisplayTemp
Wait 1
Goto TOP
MeasTemp:
hspisetup spimode11e, spimedium
pause 5
low CS ‘ enable chip select
high SCK
hspiin (b0,b1)
low SCK
Return