parellel hex input on a 08M?

nickwest

Member
I want to read data from a Holtec HT9170D DTMF receiver (datasheet at http://www.alldatasheet.com/datasheet-pdf/pdf/64510/HOLTEK/HT9170D.html) into a PICaxe 08M. The HT9170 delivers hexadecimal data in parallel over 4 wires.

Reading this data directly with the 08M would use all its inputs, which is unsatisfactory.

My question is would it be simplest (both in terms of program complexity and component count) to try to convert the parallel data to serial, or woul it be better to just use a bigger picAXE and read the data directly. At present I am leaning toward the latter, just getting a picAXE with more input pins, but if anyone has a more elegant solution I'd love to hear it!

Thanks

Nick
 

westaust55

Moderator
Agree with Dr A that a 14M would be a better proposition.

Even then you only have one input remaining.
An option to consider is a parallel to serial input using say a 75HC165.
That will use 2 outputs (latch and clock) and one input (data). Might need another input to initiate a read depending how/when the 4-bits of data is made available. That way you still have 4 outputs and 3/4 inputs for other tasks.
 

Marcwolf

Senior Member
I had a similar situation but with 2 HEX or BDC digits. Unfortuantely you just have to go with a bigger chip.. I went to the 20M
 

vk6bgn

New Member
NICK,

Question: what are you going to use the DTMF chip for? What’s the final outcome after your 08M receives the data from the DTMF chip? Do you have heaps more code to crunch or are you just simply displaying the DTMF data to a LCD as an example. Or do you simply require a few more inputs but a small program? Lots of code may require a 18X and lots of code and lots of I/O may require a 28X.

Do you require the use of all four data bits from the DTMF chip (1-16) but lack an additional fifth input for the DTMF Data Valid bit?

Lacking a fifth input for the Data Valid bit.... possibly you could just continuously poll the four data bits and if any one of them goes high,
then Gosub … ((only an example))

b0 = pins
If b0 > 0 Then Gosub ... (one of the data bits on the DTMF chip went high)


Or maybe you could get away with just using 3 data bits (1-8) and the “Data Valid” bit?

I do not personally use the 18 pin HT9170D DTMF chip but rather the MC145436. It is a 14 pin DTMF decoder chip and I chose it for it’s availability here in Australia. Also, it didn’t appear to require the added external components, as did the HT9170D or the M-8870? All it needed was the 3.57 Mhz crystal and a 1 Meg. resistor.

Also, if at all possible, make sure that DTMF Data Bit 1 goes to PICAXE Input 1, DTMF Data Bit 2 goes to PICAXE Input 2 etc. etc. As I recall, this makes life a lot easier!

And last, something rings a bell that the number zero on a DTMF keypad is not the number zero, but rather represents the number 10! But please investigate that too, I might be wrong.

By the way, I'm using a 18X.

Anyway, that’s my 2 cents.
 
Last edited:

hippy

Technical Support
Staff member
Going to a larger PICAXE is probably the best and easiest route, keeping a single chip solution which will be easier to work with. If you convert to serial you will need hardware to do that and may likely find a PICAXE is easiest to use there, which may need to be a larger one anyway.

An alternative may be to use the DTMF decoder outputs to create a 4-bit DAC and then read its output through a single ADC input. The Data Available strobe could trigger an interrupt, a READADC will read the outputs as an analogue level and some processing will turn that back to a 4-bit value. That's going to be slower though than just reading in four digital pins and use more program code.

There's an understandable tendency to want to use the smallest and cheapest PICAXE but a little extra spent going with a more capable chip better suited to a task can save a lot in terms of effort and ease of coding further down the line.
 
Last edited:

hippy

Technical Support
Staff member
Also, if at all possible, make sure that DTMF Data Bit 1 goes to PICAXE Input 1, DTMF Data Bit 2 goes to PICAXE Input 2 etc. etc. As I recall, this makes life a lot easier!
It certainly does but the PICAXE is good at manipulating single bit data which is useful when board design or tracking means that's hard or impossible to achieve, and also handy when a circuit gets mis-wired and it's too much effort at the time to change the hardware ...

b0 = 0
bit0 = pinA
bit1 = pinB
bit2 = pinC
bit3 = pinD

In the above the pinX ( pin0, pin1 etc ) can be in any order and a resulting 4-bit, properly ordered value will end up in b0.
 

westaust55

Moderator
Going to a larger PICAXE is probably the best and easiest route, keeping a single chip solution which will be easier to work with. If you convert to serial you will need hardware to do that and may likely find a PICAXE is easiest to use there, which may need to be a larger one anyway.
Very true hippy.

converting to Analogue for ADC input needs a few resistors at small cost and PCB space.
the 74HC165 option I mentioned costs AUD$1.40ea, needs PCB space and still needs 3 IO.
Price difference form 08M to 14M here in Aust is AUD$1.45 so 14M gives more IO and overall less space.
Price difference from 14M to 20M is just AUD$0.65 with more IO and more program space.

If Nickwest is in UK then the price differences between the PICAXE chips is even closer (a matter 10 to 20 pence per size step) looking at TechSupplies price list.
 

vk6bgn

New Member
b0 = 0
bit0 = pinA
bit1 = pinB
bit2 = pinC
bit3 = pinD

In the above the pinX ( pin0, pin1 etc ) can be in any order and a resulting 4-bit, properly ordered value will end up in b0.
When creating circuit board artwork for my 18X and DTMF encoder chip project, I took the DTMF data pins to the closest PICAXE input pins. Recalling the 18X has Input0, 1, 2, 6 and 7…. I unknowingly connected the DTMF data pins to the PICAXE inputs 0, 1, 6, and 7 in no orderly fashion. To my surprise, this produced some very interesting results. Pressing key #0 returned a value of 129 in the debug window. Pressing key #1 returned a value of 64. And pressing key #3 returned 192. Etc. Etc. This haunted me for a few hours to what was happening and why.

So Nick, the data / input pin alignment does make a difference. And since the 18X has no Input3, you're bound to cross paths with this problem. Take note of Hippy's solution. It’s an easy and elegant one.(above) Some much easier then what I did to solve it. (below) You’re a legend Hippy!


GetProperDTMFData:

b0 = Pins
b0 = b0 AND %11000011

Select Case b0
Case 1
b0 = 8
Case 2
b0 = 4
Case 64
b0 = 1
Case 65
b0 = 9
Case 66
b0 = 5
Case 128
b0 = 2
Case 129
b0 = 0
Case 130
b0 = 6
Case 192
b0 = 3
Case 194
b0 = 7
End Select
Return
 

hippy

Technical Support
Staff member
Take note of Hippy's solution. It’s an easy and elegant one.(above) Some much easier then what I did to solve it. (below) You’re a legend Hippy!
It's getting the code to work which is the most important thing, no matter how one does it. Optimisations and neat tricks can always be added later.

Good point about the 18-pin PICAXE's and their non-contiguous input pins and similar tricks can be used in reverse when the output pins are not contiguous, such as the 08/08M where pin3 is input only. Putting a 4-bit value to LED's on Pins 0, 1, 2 and 4 -

b1 = display value ' Sets bit8..bit15
b0 = 0
bit0 = bit8
bit1 = bit9
bit2 = bit10
bit4 = bit11
pins = b0 ' Set output bits

Plenty of other variations on that theme too.
 

Gavinn

Member
Hi Nick,

To possibly help I've done a project using the HT9170B and PICAXE-20M which when receives a certain DTMF sequence from a receiver, reads an LM35 thermometer via ADC to work out the temperature and then using morse code transmits the temperature back on the radio, it's for remote monitoring of the temperature at one of my remote amateur radio repeater sites.

CW_Temp_Circuit_Schematic_v1.0.jpg

If you wish I can send you the schematic and PCB layout (ExpressPCB) and the .BAS code, just send me a PM.

I was thinking if you could get away with a limited number of DTMF characters you don't need to use all D0..D3 inputs with the 08M and it will free up some pins.
 
Last edited:

vk6bgn

New Member
Gavinn,

I was looking at the schematic for your DTMF/PICAXE-20M Temperature TX project.... very nice. I did notice that PICAXE pins 8 and 9 in the schematic both say ADC2/In2? Is that just a typo error???

73
VK6HV
 

nickwest

Member
Thanks to everyone for their input, it seems like I'm not the first to try such a project... and you've anticipated issues I'll face that I hadn't even thought of yet!

I'll definitely go for a more capable picaxe, otherwise it seems I would have to throw far more components at the problem, and still be less flexible than a bigger picaxe would allow me to be.

HamRadioAddict, I'll definitely look into the MC145136. I'm in .au too, where do you buy yours from? I bought my holtec DTMF chips from futurlec and found their service to be very quick and reliable.

Gavinn, PM sent.

Nick
 

vk6bgn

New Member
HamRadioAddict, I'll definitely look into the MC145136. I'm in .au too, where do you buy yours from?

NICK,

I purchased my MC145436 DTMF Decoder chip from Jaycar Electronics. Stock #ZK-8870. A bit pricey! $7.50 ea. Being that I am located far up the North West Coast, nothing happeneds fast. Absolutely guaranteed over night mail takes two days and normal 3 - 5 days "any were in Australia" takes about 7 days. Something I always factor in. Not sure where they fill the order....Sydney! Lol. Then send it all the way across country and then chuck a right hander in Perth and head another 1000 miles up the coast??? LOL.

Good Luck.

"Hammy"
 

nickwest

Member
I can't spell

Oops, I just realised I spelled "parallel" incorrectly in my question!

Thanks for the tip "Hammy". Futurlec do their dtmf decoder for 60c, freight for $4. However, as you said, it's a bigger IC and requires a few resistors and caps to make it work... If my design has a future I may need to reconsider my sources. And I am fortunate enough to live close to Jaycar, which make using their components particularly attractive.

I'm off to order a couple of 20Ms and keep experimenting. Thanks again to everyone for all the assistance!

Nick
 
Top