Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

interfacing the MC serial port

Status
Not open for further replies.
actually , i tested the 1pps pin and found it low all the times, anyhow , i will test it on the oscilloscope later, this isn't bother me now,
now i am soldering the max connections,
i will make it and then tellin' you the results,
thanks for all those helped me
( lot of hugs and kisses ) :wink:
 
Watch out for the polarity of capacitors in the max chip.

Some of them are connected in reverse polarity, i.e. negative to +5V and positive to 0V.
 
OH NO

the kit has a status LEDs, one of them is for RxD, the data sheets says that this LED is normally off, flashes RED whenever commands are sent from host to the module, solid RED on the LED indicates that kit board is not hooked to host properly,

when i connected the rs232 port to the computer, the LED went off, till now, there's no problem,
the problem is when i connected the module to mc via the max, the LED didn't go off !!
why ?!
 
Can you post a schematic or describe which signal pin of the Max232 chip go to where.

e.g. like

pin 12 connects to 89C51 RXD,
pin 11 connects to 89C51 TXD,
pin 13 connects to GPS TD,
pin 14 connects to GPS RD

Also check each electrolytic capacitor(total 4) of the MAX232 has voltage across them with correct polarity same as their pins.
 
pin 12 connects to 89C51 RXD,
pin 11 connects to 89C51 TXD,
pin 13 connects to GPS TD,
pin 14 connects to GPS RD
yes, i did that indeed
and here is the current status of the max
when i supplied its power by ~4.6 v
the pin 11 ( MC Tx ) = 2.8 v
the pin 12 ( MC Rx ) = 4.5 v
the pin 13 ( GPS TD) = 0 v
the pin 14 ( GPS RD) = -8.1 v

and when i put a zero volt on pin 11( MC Tx) , pin 14(GPS RD) = +8.4
,when i put a one volt on pin 11( MC Tx) , pin 14(GPS RD) = -8.1
that's good :D

when i put a 8v volt on pin 13 ( GPS TD ), pin 12 ( MC RX ) = 0 v ,
when i put a -8v volt on pin 13 ( GPS TD ), pin 12 ( MC RX ) = 4.7 v
, and the question is still remaining,
why the kit RxD LED is still on ?
why the kit doesn't feel thee host properly ?

note : till now i didn't send any commands to the GPS module,
may be this is why the kit led is solid on, or by another meaning, it's waiting the command to become off ? ( i don't think so ) :?
 
Well done. The signalling levels are correct.

You have TTL for those connections to MC and RS232 level to the GPS.

I don't know why the LED would not go off. Do you know how many wires are there on the GPS RS232 port as the connecting cable plug might have internal handshaking connections.

On the cable that works with the PC, use an ohmmeter to check the cable plug pins that goes into the GPS RS232 port. i.e. item B in the image below. Assuming a 9-pin port.

Is pin 7,8 connected together (RTS-CTS)
Is pin 6,4 connected together (DSR-DTR)
 

Attachments

  • cable.gif
    cable.gif
    3.1 KB · Views: 475
well EBLC, really it's so kind of you to concern about me , thanks a lot, you are really a gentleman :)
i've tested the cable pin ass. , and here is the result

the pin 1 goes to pin 1 only
the pin 2 goes to pin 2 only
the pin 3 goes to pin 3 only
the pin 4 goes to pin 4 only
the pin 5 goes to pin 5 only
the pin 6 goes to pin 6 only
the pin 7 goes to pin 7 only
the pin 8 goes to pin 8 only

ha? :roll:
 
Does the GPS kit data shows the signal name on the pinout of its RS232 port?

It seems that we have to leave the LED issue for a while.

The next thing you would be doing is to write a short code on MC to check both receive and transmit function of MC.

After you initialised the serial port on MC, do something like these,

Code:
;-------------------------------------------------
;Reply to characters sent from serial port
;
;Double chars will be sent back upon received one
;-------------------------------------------------
;
ckloop:
	jbc ri,receive	;a character received
	sjmp ckloop	;
	;
receive:
	mov a,sbuf	;read the char sent from PC
   mov r7,a        ;keep a copy
	mov sbuf,a	;re-send it back to PC
wait_tx:
	jbc ti,xxx	;wait until it is sent
	sjmp wait_tx
	;
xxx:	mov sbuf,r7	;send same character again
	;
wait_tx1:
	jbc ti,ckloop	;wait until it is sent
	sjmp wait_tx1
	;

On the PC use hyperterm or any terminal program to test the interface of MC. Every character you sent from PC would be send back twice by the MC to the terminal program.

Edited: Code added to test both receive and transmit function of RS232 on MC.
 
Okay EBLC, i will test this program tomorrow , because i don't have the programmer at this moment,
anyhow, i've connected the MC and the GPS module and tested this program
but it didn't work !
ORG 0H ; Start at location 0 in the ROM
Mov TMOD, #20H ; Timer 1 Mode 2
Mov TH1, #-3 ; 9600 Baud rate
Mov SCON, # 50 H ; 8-bit, 1 stop bit, REN enabled
SETB TR1 ; Start timer

Mov A, # 40 H ; Transfer “@”
Acall Trans
Mov A, #40 H ; Transfer “@”
Acall Trans
Mov A, # 48H ; Transfer “H”
Acall Trans
Mov A, #62H ; Transfer “b”
Acall Trans
Mov A, # 00H ; Transfer “r” output rate
Acall Trans
Mov A, # 2A H ; Transfer checksum
Acall Trans
Mov A, # 0D H ; Transfer < SR >
Acall Trans
Mov A, # 0A H ; Transfer < LF>
Acall Trans
Sjmp Joey

Trans: Mov SBUF, A ; Load SBUF
Julia: JNB TI, Julia ; Wait for last bit to transfer
CLR TI ; Get ready for next bit
RET

Joey: Mov R2, #54 ; Load counter
Mov R0, # 30 H ; Load pointer R0 =30 RAM address
Wait: JNB RI, Wait ; Wait for char. To come in
Mov A, SBUF ; Save incoming byte in A
Mov @R0, A ; Copy A to RAM location R0 points to
INC R0 ; Increment R0 pointer
CLR RI ; Get ready to receive next byte
DJNZ R2, Wait ; decrement and jump to Wait if it is not Zero
CLR P2.4 ; set alarm
End: Sjmp End


explanation : i am sending @@Hb0<SR><LF> to the GPS module and then saving the response ( 54 bytes )
 
I have checked your MC program and the data that you sent to GPS. The checksum byte 2AH is also correct. No problem so far.

However, I would suggest you connects the GPS to a PC terminal program and check that you can actually get back the 54 byte messages from the GPS before you testing this on the 89C51. At least you know the GPS is responding to commands.

Then if that's OK, you test the MC for correct serial operation using the code that I posted earlier.

I would also suggest you check the following points:

1. Make sure MAX232 pin 13 is connected to GPS RS232 Pin2 & MAX232 pin14 is connected to GPS RS232 pin3, whatever cable your using.

2. The M12+ needs time to search for satellites upon power up and this may take time.

3. Is the antenna connected and have a good unrestricted view of the sky?

4. The MAX232 chip need time to generate the required voltage upon power up but before it can do so it was asked by the MC to transmit the byte to GPS. Normally I would wait about a second or two before sending any bytes out via the serial port. Please put in a time loop to wait for one second upon startup before sending anything out.
 
thaaaaaaaaaaaaaaaaaaaaaaaanks
thanks thanks thaaaaaaanks
thanks a million EBLC,
it's working :lol: :lol: :lol: :lol:
you are a fabulous man, thanks alot dear
( a lot of kisses for you )
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top