Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] Mikroc working not properly

Status
Not open for further replies.
OK, try something different:

REMOVE the PIC and link together the place RC6 and RC7 were. See if the PC sees it's own data back in 'loopback' mode. You would be returning the data directly without it passing through the PIC, this will check the MAX232 and PC serial interface is working properly.

If that works, remove the link and refit the PIC. Change the code so you make one of the ports (PORTB for example) an output, then copy the byte you receive from the UART to that port. You should see the ascii code for the character you enter on the PC across the bits of the port. For example if you press 'U' the port should hold 01010101.

Can you confirm you used a MAX232 and not a MAX232A.

Brian.
 

Yes I did.

- - - Updated - - -

I used max232n

- - - Updated - - -

I did remove and were the wire together then I send character but it won't loop back. About to verify byte that char send from pc I already done. The problem is it receive wrong character like what I told you send number1 pic receive letter a and pc not receive data.
 

hello,



on your terminal (COM16) , if you have checked send LF +CR
when you send YOUR char , you send not only one, but 3 cars at the same time !
and wihout do an error treatment , OVERUN or OVERFRAME error you can be stuck in your program.
 

Yes I checked it. So what I am going to do? And it not receive or loop back also.
 

If you get no loop back with a direct connection between TX and RX you can eliminate the PIC, at least for now. The PC (or USB) interface is locked so the transmit and receive rates and the stop bits are always the same so it should 'echo' everything you send it without change. It looks like the problem is in the MAX232 part of the circuit. Please unplug the connection from the PC and link together pins 2 and 3 of the data connector on the PC side. Check it now returns any character you send it.

If it doesn't, your USB serial port is faulty!
If it does work, the next thing to do is check the voltages on the MAX232. Use a voltmeter with its negative side to ground and tell me the voltages you measure on pins 2, 6 and 16.

Brian.
 

So basically you are saying if you remove the whole project and just loop the PC back to itself it still doesn't work. That can only mean the PC serial port is faulty!

Brian.
 

Yes! So what do I need to do next? Please recommended the model USB to serial and how to setup software if I need to buy new one! I used dtech brand made in China and lot of software to setup. It's really hard.
Thanks for your gentle love to see your reply.
Johnny.
 

I'm not sure what is available in you country (Cambodia?) but if you search for "USB Serial" you should find something. There are hundreds of adapter cables available, USB at one end and a 9-pin 'D' connector at the other. They are nearly always based on converter ICs made by FTDI or Prolific Technology which are supported by most operating systems.

The cheapest I could find on Ebay was only UKP 0.55 which is about 4,000 Riel.

Brian.
 

I bought new sub to serial but the result the same. How do you get loop back? Are you using Mikroc terminal?
 

Loopback to test PC connection:
a) connect usb to serial adapter (if required) and check the port number that it simulates (eg port7)
b) open a terminal program like putty or hyperterminal
c) select the com port of the adaptor (eg com7) and select any speed (eg 9600, no parity, 1 stop bit) but important NO HARDWARE handshake, not even XOR/XON.
d) short pins 2 and 3 of the rs232 D9 connector on the adaptor and...

test it.
Anything you type, should be echoed back to terminal.

After correct operation, remove short on pins 2,3 and put the max232 in place, without mC.
Short pins RX,TX on mC socket and power it on.
Loopback should continoue on the PC terminal
 

I have hyper terminal but when I connect it it won't allow me to type any character. I follow you but it could not
 

If the serial port can't talk to itself, it has no chance of talking to your PIC.

Just to recap:
1. You have a USB to serial adapter cable
2. The software driver for it is installed
3. You have linked pins 2 & 3 together at the adapter
4. You are running Hyperterminal (usable but horrible!)
5. Hyperterminal is configured for the correct port and no handshake
6. Characters you type in are not shown on the screen.

If all of that is correct, use a voltmeter, connect the negative wire (black) to pin 5 and tell us the voltages you measure on the other pins. Do not be suprised if some of them are negative, they should be.

Brian.
 

hello,


link 2 & 3 link is the minimum request to get a loop back.. but is not 100% STANDARD
some RS232 Terminal needs also other DB9 pins to be strapped
like CTS,RTS ...
Terminal must be declared also with No Protocol

**broken link removed**


Hyperterminal is not the best to solve this problem ...
Mainly use with modem and many pins to control data exchange
Try to use another terminal software..

i use VBray on XP and Teraterm on Win8
 

5. Hyperterminal is configured for the correct port and no handshake
should work in Hyperterminal. The protocol should not matter as it is only used in block transfers, not single characters. Lets see what voltages Johnny Churne reports back, it will give some insight to whether a null modem type of cable is needed although I don't think it should be.

Brian.
 

Sorry for very late in reply. Here you are
Pin 1=0
Pin 2= -
Pin3= -
Pin4= 0
Pin 5= Gnd
Pin6 =0
Pin7=0
Pin8=-
Pin9 =0
For the negative I don't know how many volts I use analog voltmeter. I can type character in hyper terminal by setting echo but nothing return. I attached photo about Aries erro for your.
Thanks!
 

OK, that wasn't very useful!

To measure the negative voltages, swap the wires at the voltmeter. The readings will be the same but the needle will move in the right direction!
Something doesn't look right if both pins 2 and 3 are negative but to be sure, I need to know what the actual voltages are.

Brian.
 

Here i measure all the pin again!
Pin1=0
Pin2=-9
Pin3=-9
Pin4=0
Pin5=GND
Pin6=0
Pin7=0
Pin8=-9
Pin9=0

- - - Updated - - -

If i connect to max232
Pin2=9v
Pin6=-8v
Pin16=5v
 

The simplest way to check the hardware is to disconnect the Rx anf Tx from the PIC and short them. If you see the characters you send from the keyboard on the PC screen, your hardware is good. Remember to turn off the auto echo from your terminal program.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top