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.
I did it but it doesn't work. I already bought 2 difference company but the same chip PL2303 profilic.
 

Gorgon - we are a step ahead of you. At the moment the PIC is completely diconnected and the loopback link is between pins 2 and 3 of the 5-pin 'D' plug on the serial adapter but it still doesn't work.

The voltages are not unreasonable but I would not expect pin 2 to have -9V on it when disconnected. On a serial port, pin 2 is an input so it would be driven with a voltage from outside (the PIC/MAX232 circuit), without being driven it would normally be at 0V. However, connecting the MAX232 raises it to +9V (idle state voltage) so possibly the serial adapter has a pull-down resistor in it. Regardless of those voltages, with pins 2 and 3 linked and handshaking disabled, it should echo any characters sent out of the port. The fact that it returns wrong characters means something is wrong with the serial adapter and no amount of changing PIC software will fix that.

Brian.
 

So what should I do? Shall I buy new serial adapter. What do you think if I buy FTDI cable it is compatible with any pic? Please recommend me!
Regard johnny
 

hello,

FTDI cable it is compatible with any pic?

Your main problem is your converter USB/RS232 ...
you must get feedback is you link pin 2 & 3 on your DB9 RS232 connector ( so PIC is not involve in this case)

I have an Trend TUS9 USB/RS232 cable ..(prolific driver )
and when i strap on DB9 2 & 3 pins ..i get echo on all i type on keyboard.
Be carreful 2 & 3 pin are not on same direction if your DB9 connector is MALE or FEMALE
Mirror effect !
if you can't solve this problem , No chance to communicate with a PIC ..
.
Test_cordon_USB_RS232.jpg
 

It is still pins 2 and 3, one is TX and the other RX, as long as they are joined it doesn't matter if it is male or female.

I just tried a "Sweex" USB to RS232 adapter cable, under Windows, using Hyperterminal. It uses the Prolific PL-2303 chip and it worked exactly as expected. With no link across 2 & 3 it echoed nothing, when they were linked and with nothing else connected, it echoed everything back I typed in.

Possibly the Windows driver is corrupted. Try uninstalling it from the control panel and re-install it again.

Brian.
 

I try many times it still the same! Even though I reformat my window and in stall window7 to it it still ton work
 

That is strange!

Here, I have nothing but the cable adapter with a 9-pin 'D' connector at one end and a USB plug at the other. It works with pins 2 & 3 linked and does not work when the link is removed.

If you boot the computer and then insert the USB plug, does it gve you a message saying something like "Prolific PL2303 serial found"? The only explanation I can think of is Windows has incorrectly identified the adapter. If you can get to the Windows control panel and hardware properties, see if it shows a serial port is there and it uses the Prolific IC.

Brian.
 

hello,

I try many times it still the same! Even though I reformat my window and in stall window7 to it it still ton work

it is an abormal situation to turn around this problem after 48 post !
Try another terminal software like teraterm (see post #44)
and take a display capture to show your selected COM port..
you must see COMxx Prolific ...


and on your DB9 male did you strap the correct pin 2 & 3
(because some connector doesn't have Pin number written inside , see photo..)




As Betwixt suggestion,
when i plug my USB/RS232 converter on my PC (i use WIN8) i get an additional COM12 = Prolific driver

** probleme to join image !

- - - Updated - - -

oups ! impossible to join with attachment ?

 
Last edited:

I will report to you for every thing but the problem is I can't post picture through this forum !
 

Mister Brain It works I can receive data from pic now it was my mistake I connected wrong pin thanks to Paulfjujo post the com port PIN number. But there is one more problem I receive wrong data and the data is not constantly receive.
 

I receive wrong data and the data is not constantly receive

on wich side .. PC side or MCU side ?


if probleme is MCU side:
if you type one char by one char ,it could works wihout problem
but when you send a string (many char ) from your PC to the MCU
you must treat Receive char by interrupt, use a buffer to store the cars, and treat UART errors
to avoid stuck program.

show us your code ...
type of MCU..
 

I don't know exactly the problem from MCU or PC but it the same like what you said. if I send char one by one the pc receive constantly, if I send as string it is not stable. I send number 1 from PC the MUC verify to letter 'a' I know it by using if statement in MCU.
Here is my code:

Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
char ch;
void main(){
TRISC=0B10000000;
PORTC=0X00;
UART1_INIT(9600);
Delay_ms(100);
while(1){
if(uart1_data_ready()){
ch=uart1_read();
uart1_write(ch);
} //end if
}// end while
}  //end main

 
Last edited by a moderator:

type of MCU.. ?

FOSC value ?
internal oscillator or Quartz (xxMhz) to define FOSC ?


join your *.cfgsch configuration file or copy the "Edit projet window"
to see all your config.bit





I send number 1 from PC the MUC verify to letter 'a' I know it by using if statement in MCU.

do you send '1' to the MCU , and feedback echo is 'a' ?
 

Sorry for the account above I login with my friend's Facebook history in my I pad. Sorry for this.

I don't understand your question above. I send number 1 the MCU verify to letter a by if statement
If(ch=='a'){
Portb =0b11111111;
}

When I send number 1 then portb give out put.
Also internal clock I use HS 8MHz, external clock I use crystal 8MHz. Do I need to link com port to make hand shake?
 

I don't understand your question above. I send number 1 the MCU verify to letter a by if statement
If(ch=='a'){
Portb =0b11111111;
}

type of MCU.. ?

if you type 1 ... is it the key '1' on your keyboard ?
so, why do you check 'a' ?


you must check
Code:
If(ch=='1'){
Portb =0b11111111;
else
PORTB=0;
}

post all your code
and config bit file ( yourprojectname.cfgsch) or display capture of "Edit project window"
 

Yes it is the key on computer's keyboard, if I check 1 portb will not give out put. If I check a portb will give out put.
 

give details if you want help !

type of MCU.. ?
post all your code
and config bit file ( yourprojectname.cfgsch) or display capture of "Edit project window"
 

give details if you want help !

type of MCU.. ?
post all your code
and config bit file ( yourprojectname.cfgsch) or display capture of "Edit project window"

Thank you very much! I solve it. I change internal clock to 20MHz and external to 20MHz then it give correct data. One more thing i want to send data as array and want to get each array. When I send it for the first time it receive correct but send for the second time it not correct so what shall I do?
 

That is strange!

Here, I have nothing but the cable adapter with a 9-pin 'D' connector at one end and a USB plug at the other. It works with pins 2 & 3 linked and does not work when the link is removed.

If you boot the computer and then insert the USB plug, does it gve you a message saying something like "Prolific PL2303 serial found"? The only explanation I can think of is Windows has incorrectly identified the adapter. If you can get to the Windows control panel and hardware properties, see if it shows a serial port is there and it uses the Prolific IC.

Brian.
Mister Brain I would like to say thank very much to you for your consideration and your gentleman you are a very big part of my life and my country I appreciated for what you have done to me. If some day you could come to Cambodia I would accompany you to every where in Cambodia. Thanks for all friend in this forum too.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top