![]() | ![]() | ![]() |
| |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
![]() |
| | Tools |
| | #1 |
|
Does anyone have any experience with interfacing an MT8888 DTMF transceiver to a PIC controller? Basically I have been having fits trying to get the timing correct to output a tone. Any help at all would be appreciated. Thanks, Don: | |
| |
| | #2 |
|
I need to be able to send the 4 bit code representing a number and have the MT8888 produce the tone . Also, I would need to decode the incoming tone to the MT8888 and send the 4 bit code to the PIc. Thanks, Don | |
| |
| | #3 |
|
Post your schematic and code.
| |
| |
| | #4 |
|
This is how it is wired and here is some code I have tried. Code: OSCCON = $60 ' Set up internal oscillator x var byte dtmf var byte CS var portb.4 'Enable or disable MT8888 RD var portb.5 'Read Microprocessor input WR var portb.6 'Write Microprocessor input RS var portb.7 'Register Select data @1,8,7,0,7,3,7,5 TRISB = %00000000 portb = %11000000 portb = %10100000 portb = %10100000 portb = %10101000 portb = %10100000 portb = %11000000 pause 10 Send_DTMF: portb = %10101101 'Send Control Register A portb = %10100000 'Send Control Register B portb = %10100110 'Send digit = 7 portb = %10100100 ' Send digit = 5 Goto Send_DTMF | |
| |
| | #5 |
|
Blueroomelectronics, I posted my code and schematic the other day - now what? | |
| |
| | #6 | |
| Quote:
You need to setup the D0-D3, RSO and CS pins first while maintaining WR and RD high. Then you wait a minimum of 45ns. Then you toggle WR low for a minimum of 150ns and then high again to write data to the MT8888. Then you wait a minimum of 100ns. Then you can repeat with the next command. You are trying to do all this with one 8bit write to portB which isn't the same and won't work. You'll also have to read the STATUS register in the MT8888 to see if it is ready to accept new data. ie: You must give time for the DTMF tone to be played before you command it to send the next one.
__________________ Inside every little problem, is a big problem trying to get out. Last edited by kchriste; 20th December 2008 at 05:59 AM. | ||
| |
| | #7 | |
| Quote:
Do I set CS low to enable the MT8888? and leave it low? I am looking at the datasheet 'Typical control sequence for burst mode applications' and I don't see CS in there at all however, it is used in the write timing diagram. I guess I just need to know how you would set up the above quote in a statement or two. Thanks for jumping in, Don | ||
| |
| | #8 | |||
| Quote:
When sending or receiving a DTMF digit, you set RS0 low. Quote:
Quote:
__________________ Inside every little problem, is a big problem trying to get out. | ||||
| |
| | #9 | |
|
I am going to try this, how do you think it looks? Code: OSCCON = $60 ' Set up internal oscillator CS var portb.4 'Enable or disable MT8888 tied to ground RD var portb.5 'Read Microprocessor input WR var portb.6 'Write Microprocessor input RS var portb.7 'Register Select TRISB = %00000000 'Set portb to output portb = %11000000 portb = %10100000 portb = %10100000 portb = %10101000 portb = %10100000 portb = %11000000 pause 10 Send_DTMF: portb = %10101101 'Set up Control Register A pause 1 'Wait 1 millisecond portb = %10100000 'Set up Control Register B pause 1 'Wait 1 millisecond portb = %01100000 'Set WR, RD high CS and RS0 and rest of portb low pause 1 'Wait 1 millisecond portb = %00000110 'Send digit = 6 pause 10 'wait 10 milliseconds low WR 'Take portb pin 6 low pause 10 'wait 10 milliseconds high WR 'take portb pin 6 high Goto Send_DTMF 'loop forever End It says to do this 100ms after power up. Quote:
Last edited by dbachman; 21st December 2008 at 02:08 AM. | ||
| |
| | #10 |
| It's not going to work. I suggest that you create a subroutine for writing commands to the MT8888. Syntax will be wrong, but this is the idea: Code: sub WriteControlRegister(command) command = command AND 0x0F 'Mask off upper 4 bits with Logical AND portb = command OR %11100000 'Set upper 3 bits with Logical OR and send to portb pause 1 'Wait 1 millisecond (may not be needed) low WR 'Take portb pin 6 low pause 1 'Wait 1 millisecond (may not be needed) high WR 'take portb pin 6 high end sub Code: WriteControlRegister(%1101) 'Write to Control Register A (tone out, DTMF, IRQ, Select Control Register B) WriteControlRegister(%0000) 'Write to Control Register B (burst mode)
__________________ Inside every little problem, is a big problem trying to get out. | |
| |
| | #11 | |||
|
Hi KChriste, I think I can figure out how to make and call a subroutine once I get to the point of getting the MT8888 to reliably produce a tone. Unless, you think subroutines would be the best way from the outset. I was just trying to get the thing to produce a tone and then structure the program to read from a data statement. Is this: Quote:
Quote:
Quote:
Here is maybe a start: Code: OSCCON = $60 ' Set up internal oscillator
CS var portb.4 'Enable or disable MT8888 tied to ground
RD var portb.5 'Read Microprocessor input
WR var portb.6 'Write Microprocessor input
RS var portb.7 'Register Select
TRISB = %00000000 'Set portb to output
command var byte
data @4,%1101,%0000'Data starting at position #4
data @6,8,7,0,7,3,7,5
WriteControlRegister:
command = command & $0F 'Mask off upper 4 bits with Logical AND
portb = command | %11100000 'Set upper 3 bits with Logical OR and send to portb
pause 1 'Wait 1 millisecond (may not be needed)
low WR 'Take portb pin 6 low
pause 1 'Wait 1 millisecond (may not be needed)
high WR 'take portb pin 6 high
Return
WritetransmitRegister:
command = command & $0F 'Mask off upper 4 bits with Logical AND
portb = command | %11100000 'Set upper 3 bits with Logical OR and send to portb
pause 1 'Wait 1 millisecond (may not be needed)
low WR 'Take portb pin 6 low
pause 1 'Wait 1 millisecond (may not be needed)
high WR 'take portb pin 6 high
return
SetupAandB:
for x = 4 to 5
read x, command 'Read data statement starting at location #4 and put in command
gosub writecontrolregister
next x
gosub Setuptransmitregister
Setuptransmitregister:
for x = 6 to 12
read x, command 'Read data statement starting at location #6 and put in command
gosub writetransmitregister
next x
End
Last edited by dbachman; 21st December 2008 at 09:00 PM. | ||||
| |
| | #12 | ||
| Quote:
Quote:
Code: WriteControlRegister(%1101) 'Write to Control Register A (tone out, DTMF, IRQ, Select Control Register B) WriteControlRegister(%0000) 'Write to Control Register B (burst mode) Code: portb = %11101101 pause 1 'Wait 1 millisecond (may not be needed) portb = %10101101 'Take portb bit 6 low pause 1 'Wait 1 millisecond (may not be needed) portb = %11101101 'take portb bit 6 high ' Small delay here due to routine above returning ' and the routine below being called. portb = %11100000 pause 1 'Wait 1 millisecond (may not be needed) portb = %10100000 'Take portb bit 6 low pause 1 'Wait 1 millisecond (may not be needed) portb = %11100000 'take portb bit 6 high
__________________ Inside every little problem, is a big problem trying to get out. | |||
| |
| | #13 |
|
I am having a bit of trouble with the MT8888 as it wants to oscilliate and produce a tone even while it is diconnected from power. Sounds kind of strange but it is still hooked up to the pic. I have completely erased the pic and disconnected it from the MT8888 but when I connect it back up it produces a tone. Before I couldn't get it to make a peep and now it wont shut up. Maybe the cheap solderless board I'm using. Don | |
| |
| | #14 |
|
Remember that the MT8888 is a CMOS device and has built in protection diodes on the inputs which connect to Vdd and Vss. If one or more of the inputs is held high, then the MT8888 will be powered via the protection diode on the input pin. It could also be a breadboard problem.
__________________ Inside every little problem, is a big problem trying to get out. | |
| |
| | #15 |
|
Hi Kchriste, I don't want to seem like I am slacking on writing this code, but I haven't gotten very far with what I have done. I was wondering if you could show me a snippet that produces a tone just to make sure everything I have wired is working ok. I ordered a few more MT8888's just in case I fried this one. Thanks Don | |
| |
|
| Tags |
| dtmf, mt8888, pic, transceiver |
| Thread Tools | |
| Display Modes | |
| |
Similar | ||||
| Title | Starter | Forum | Replies | Latest |
| 18f2550 programming (HW) | lez | Micro Controllers | 4 | 1st November 2009 10:44 AM |
| 18F2550 ADC troubleshooting | theo92 | Micro Controllers | 0 | 12th December 2008 01:37 PM |
| 18F2550 USB on VB Express 2008 | serkanc | Micro Controllers | 4 | 18th May 2008 02:04 PM |
| 18f2550 and cypress FX2 programmer?? | patroclus | Micro Controllers | 15 | 17th July 2006 09:23 AM |
| 18f2550 programming (SW) | lez | Micro Controllers | 4 | 6th June 2006 12:45 PM |