![]() | ![]() | ![]() |
| |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
![]() |
| | Tools |
| | #16 |
|
I'd like to help you out, but I have neither PIC basic nor a MT8888 to try it out on. I've simply read the datasheet and tried to point you in the right direction. Anything I write would be pseudo code which you'd have to rewrite for it to work on your compiler. Here are some links that may help: Home security system It looks like the CM8888 is the same as the MT8888: Design and Implementation of DTMF Detector - Scientific, embedded, biomedical, electronics contents.
__________________ Inside every little problem, is a big problem trying to get out. | |
| |
| | #17 |
|
Hi Kchriste, I am waiting for a shipment of 6 new MT8888's before I continue. I have tried a bit to get this one to work but I think I may have fried it. Don | |
| |
| | #18 |
|
Hi KChriste, Are you still around? I was wondering if you or someone could look at this code and see where I am going wrong. I realize you aren't PicBasic savvy but it is kind of straight forward. It still doesn't seem to work. Thanks, Don 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
Init var byte
Control var byte
Dtmf var byte
Status var byte
w var byte
X var byte
y var byte
z var byte
data @1,%11000000,%10100000,%10101000,%10100000,%10101101,%10100000,%00001000,%00001110,%00000001,%00001110,%00000011,%00001110,%00000110 'Data starting at position #1
Gosub Initialization
gosub SetupControlRegister
gosub WriteTransmitRegister
Initialization:
Gosub ReadStatusRegister
for w = 2 to 4
read w, Init 'Read data statement starting at location #2 and put in Init
Init = Init & $0F 'Mask off upper 4 bits with Logical AND
portb = Init | %11100000 'Set upper 3 bits with Logical OR and send to portb
pause 10 'Wait 1 millisecond (may not be needed)
low WR 'Take portb pin 6 low
pause 10 'Wait 1 millisecond (may not be needed)
high WR 'take portb pin 6 high
pause 10
Next w
Return
ReadstatusRegister:
read 1, Status 'Read data statement starting at location #1 and put in Status
Status = Status & $0F 'Mask off upper 4 bits with Logical AND
portb = Status | %11100000 'Set upper 3 bits with Logical OR and send to portb
pause 10 'Wait 1 millisecond (may not be needed)
low RD 'Take portb pin 5 low
pause 10 'Wait 1 millisecond (may not be needed)
high RD 'take portb pin 5 high
pause 10
Return
SetupControlRegister:
for x = 5 to 6
read x, Control 'Read data statement starting at location #6 and put in Control
Control = Control & $0F 'Mask off upper 4 bits with Logical AND
portb = Control | %11100000 'Set upper 3 bits with Logical OR and send to portb
pause 10 'Wait 1 millisecond (may not be needed)
low WR 'Take portb pin 6 low
pause 10 'Wait 1 millisecond (may not be needed)
high WR 'take portb pin 6 high
pause 10
Next X
Return
WriteTransmitRegister:
for y = 7 to 13
read y, Dtmf 'Read data statement starting at location #9 and put in Dtmf
Dtmf = Dtmf & $0F 'Mask off upper 4 bits with Logical AND
portb = Dtmf | %11100000 'Set upper 3 bits with Logical OR and send to portb
pause 10 'Wait 1 millisecond (may not be needed)
high RD 'Take portb pin 5 high
pause 10 'Wait 1 millisecond (may not be needed)
low RD 'take portb pin 5 low
pause 10
Next y
Return
End
Last edited by dbachman; 19th January 2009 at 11:09 PM. | |
| |
| | #19 |
|
In your Initialization routine, you only do 3 writes to the control registers. The Data sheet shows 4 writes with the first two being duplicated. Since the upper 4bits are masked off anyway, you could fix that by changing for w = 2 to 4 to for w = 1 to 4 There is also supposed to be a read from the status register at the beginning of the Initialization routine and at the end. You only have it at the beginning. I have only glanced briefly at the rest of the code.
__________________ Inside every little problem, is a big problem trying to get out. Last edited by kchriste; 20th January 2009 at 12:05 AM. Reason: for w = 2 to 4 | |
| |
| | #20 |
|
The Apps engineer a Zarlink said the Write was a redundant one. Have a look at this code using an MT8880 (which is almost the same). It's datasheet is very similar. It doesn't even initialize it even tho the datasheet says it should. Also this attachment. I am not good at Assembly. Thanks, Don Code: ' Listing 1. Stamp-Based Autodialer ' Program: DIAL.SRC (Sends a string of DTMF tones via the 8880) ' This program demonstrates how to use the CM8880 as a DTMF tone ' generator. All that's required is to initialize the 8880 properly, ' then write the number of the desired DTMF tone to the 8880's ' 4-bit bus. ' The symbols below are the pin numbers to which the 8880's ' control inputs are connected, and one variable used to read ' digits out of a lookup table. SYMBOL RS_p = 4 ' Register-select pin (0=data). SYMBOL RW_p = 5 ' Read/Write pin (0=write). SYMBOL CS_p = 6 ' Chip-select pin (0=active). SYMBOL digit = b2 ' Index of digits to dial. ' This code initializes the 8880 for dialing by writing to its ' internal control registers CRA and CRB. The write occurs when ' CS (pin 6) is taken low, then returned high. See the accompanying ' article for an explanation of the 8880's registers. let pins = 255 ' All pins high to deselect 8880. let dirs = 255 ' Set up to write to 8880 (all outputs). let pins = %00011011 ' Set up register A, next write to register B. high CS_p let pins = %00010000 ' Clear register B; ready to send DTMF. high CS_p Stamp Applications no. 7, September 1995 7 ' This for/next loop dials the seven digits of my fax number. For ' simplicity, it writes the digit to be dialed directly to the output ' pins. Since valid digits are between 0 and 15, this also takes RS, ' RW, and CS low--perfect for writing data to the 8880. To complete ' the write, the CS line is returned high. The initialization above ' sets the 8880 for tone bursts of 200 ms duration, so we pause ' 250 ms between digits. Note: in the DTMF code as used by the phone ' system, zero is represented by ten (1010 binary) not 0. That's why ' the phone number 459-0623 is coded 4,5,9,10,6,2,3. for digit = 0 to 6 lookup digit,(4,5,9,10,6,2,3),pins ' Write current digit to pins. high CS_p ' Done with write. pause 250 ' Wait to dial next digit. next digit end ' Listing 2. | |
| |
| | #21 |
|
Well, you could try the example code you posted above. Looks like you'd have to mod your hardware a bit though. I noticed that the author is setting up the RW, RS, CS and data bits first and then just toggling CS high again to finish the write cycle. Might be worth giving it a try as the code has been tested so if it doesn't work then it must be a hardware issue. Might narrow things down for you.
__________________ Inside every little problem, is a big problem trying to get out. | |
| |
| | #22 |
|
I did give it a try but I am still waiting for the new MT8888's to come in the mail. They keep pushing the ship date out. I might be fighting a fried chip. 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 |