Shiftin Firmware error

gtslabs

Member
I am trying to read 4 BCD Thumbwheels and I need 16 inputs. I am playing with the 74HC165 Shift Register.
As I am just learning the to use the picaxe I need some help gettng started.

I found an old Basic Stamp code I am tring to convert to use with my 40X1 chip.
http://www.parallax.com/dl/docs/books/sw/exp/sw24b.pdf

When I run the code I get a firmware error.
Can someone help me get this code working?
See the attached pic.


'Read 8 bits from 74HC165 Shit Register into 40X1
'program to be expanded to read 16 inputs with 2 shift registers

'Outputs
Symbol Load = 1 'Connected to Pin 2 of 74HC165
Symbol sClock = 0 'Connected to Pin 0 of 74HC165
'Inputs
Symbol sdata = b.7 'Connected to Pin 7 of 74HC165

Main:
High Load
gosub read165
Debug B1
Pause 100
goto main


read165:
pulsout load, 5
shiftin sClock,sdata,MSBPre_H, (b1 / 8) ‘ clock 8 bits into b1
return
 

Attachments

inglewoodpete

Senior Member
There are a couple of options available to you.

Firstly, I don't think there is a later firmware revision available to the 40x1 (I could be wrong, though).

You could upgrade the a 40X2. Of course, that would be at your expense.

Add a transistor and a couple of resistors to invert the incoming data.

Write a short piece of code to bit-bang the data into the 40x1. I have done this (but for different reasons to you). Since you are reading BCD thumbwheels, this option will probably be fast enough for you.
 

hippy

Technical Support
Staff member
I'm not entirely sure the MSBpre_H mode has to be used to read from a 74HC165 so one of the other modes that is supported could likely be used. It's probably worth searching for PICAXE example code which reads a 74HC165 and take a look at what they use.
 

westaust55

Moderator
I am not sure that the idle state makes any difference for the SHIFTIN command.
I suspect that the 74HC165 serial output will hold what ever was the state of the DS (serial input) pin after 8th bit is clocked through so you could also pull the DS (serial input) pin low to be sure.

then try using MSBPre_L in place of MSBPre_H

if that does not work then try the bit-banged code form the examples in PICAXE manual 2 (V7.9) page 227
 
Last edited:

Goeytex

Senior Member
Speaking of Firmware ......

Where does Rev Ed publish the latest Firmware Revisions for the various Picaxe Chips ?

A search of Picaxe.com did not produce anything and neither did a search of the
so-called "Datasheet" (Manual 1).
 

eclectic

Moderator
Speaking of Firmware ......

Where does Rev Ed publish the latest Firmware Revisions for the various Picaxe Chips ?

A search of Picaxe.com did not produce anything and neither did a search of the
so-called "Datasheet" (Manual 1).
firmware.txt
(On your hard drive)

On my computer, it's

C: Program Files Programming Editor

e
 

Goeytex

Senior Member
Thanks,

However that (firmware.txt) is dated Jan 12, 2012. (PE 5.51)

One would think that Rev Ed would keep a current list available somewhere.

======================================

Edit: Thanks Technical. That is was I was looking for.
 
Top