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.

[PIC] SOFT_UART pic18f452 serial communication

Status
Not open for further replies.

AboudaKing

Member level 1
Member level 1
Joined
May 22, 2019
Messages
37
Helped
0
Reputation
0
Reaction score
1
Trophy points
8
Activity points
234
hello
im doing my last year project "calculator with interface RS232 with help of pic18f452"
i'm using mikroC pro and Proteus for simulation
i looked up for the codes and i found what im looking for and the schematic as well but the problem it is not working for me ! nothing is showing in my virtual terminal at all
and i have this prob with pic pings rx/tx connecting to max232 it can be solved only when i plug
RC6=T1IN
RC7=T2IN
its suposed to be one for reciving and the other for sending
so i need help where it is wrong ?

1.png
View attachment uart.txt
View attachment programme.txt
 

Hi,

Tx of PIC is an output. But it is connected to RxOut, which is an output, too.
And Rx is an input ... and is connected to another input.

Klaus
 
Hi,

Tx of PIC is an output. But it is connected to RxOut, which is an output, too.
And Rx is an input ... and is connected to another input.

Klaus


i got that covered but still not getting any data on virtual terminal
 

You don't need MAX232 in Proteus. If you are connecting external UART device to Proteus then just use COMPIM and connect COMPIM's RXD to PIC RX and TXD to PIC's TX. The TTL level of PIC will work with COMPIM.
Also, You can connect two Virtual Terminals's RXD pins to TX and RX pins of PIC.
 

You don't need MAX232 in Proteus. If you are connecting external UART device to Proteus then just use COMPIM and connect COMPIM's RXD to PIC RX and TXD to PIC's TX. The TTL level of PIC will work with COMPIM.
Also, You can connect two Virtual Terminals's RXD pins to TX and RX pins of PIC.


it's not like that the schematic is right that's what i have to work on now i'm just facing problems with coding
can't figure out how to combine the soft_uart code with my main code
i did do .c files still not working
 

can't figure out how to combine the soft_uart code with my main code

Provide a link from where you got soft_uart code or is it that you cannot get the mikroC's Soft_Uart() library code working?
Zip and post your complete mikroC PRO PIC project and also the Proteus file.
I mainly use mikroC PRO PIC and Proteus for embedded development and I might be able to help you.

So, what is the new issue?
Getting garbage characters on Virtual Terminal of Proteus?
 

Hi,

Why do you use software UART instead of hardware UART?

Klaus
 

I'm puzzled by the pins too. TX and RX are crossed over at the interface but why use a soft UART when the hardware one is far easier and uses the same pins.
Caution: in real hardware, beware of using relatively large value capacitors on the reset pin unless you add a diode across the series resistor as well. There is a danger of the -MCLR pin retaining a higher voltage than VDD when the power supply is removed.

Brian.
 

Provide a link from where you got soft_uart code or is it that you cannot get the mikroC's Soft_Uart() library code working?
Zip and post your complete mikroC PRO PIC project and also the Proteus file.
I mainly use mikroC PRO PIC and Proteus for embedded development and I might be able to help you.

So, what is the new issue?
Getting garbage characters on Virtual Terminal of Proteus?

i'm not geting any characters on virtual terminal
and what should i zip for you ?
cause i have the code splited on 2 the soft_uart code and main code wich call like the soft_uart librery while processing
and i'm using mikroC library

i have to use softwar_uart cause its part of the project i cant use hardwar uart

im not gona apply it on hardwar just simulation on proteus

- - - Updated - - -


this is a pdf include my project ''pdf is in frensh''
and this is how its suposed to work but i did what is in it still not working and i dont get it
 

Zip all project related file you have so that it can be quickly tested and fixed if needed or explained to you want needs to be fixed.
 

here is the project
proteus+mikroC
 

Attachments

  • project.zip
    18.2 KB · Views: 122

I asked you to zip and post complete mikroC PRO PIC project files. You just attached .mcppi (project file). Where are the other files of the project like .c file, .cfg file, etc,.. needed to open the project? .mcppi file alone doesn't comtain any source code. I need the full project files to check and fix if needed.
 

I asked you to zip and post complete mikroC PRO PIC project files. You just attached .mcppi (project file). Where are the other files of the project like .c file, .cfg file, etc,.. needed to open the project? .mcppi file alone doesn't comtain any source code. I need the full project files to check and fix if needed.

sorry for that misunderstanding here are the files you need and if its not them plz explain more to what you need
 

Attachments

  • my project.rar
    85.7 KB · Views: 109

@Baileychic - AboudaKing has admitted that this is part of a project and will not ever be implemented. Therefore I hope that (s)he also gives you the credit for passing the course!
Susan
 

Okay, Susan.

@AboudaKing.

Fixed project attached.

There were two issues.

One is Proteus Virtual Terminaal cannot accept CR and LF (0x0D, 0x0A).
2nd is you were using this function

Code:
Soft_UART_Init([color=blue]&[/color]PORTC,7,6,9600,0); // TX=RC6, RX=RC7, Baud=9600

as

Code:
Soft_UART_Init(PORTC,7,6,9600,0); // TX=RC6, RX=RC7, Baud=9600

The '&' was missing in the function call.

You need Proteus 8.9 SP0 to open my file. Older versions of Proteius will not open it. Or refer included PDF file or attached image to correct the UART polarity for your simulation file.
 

Attachments

  • Calculator - Uart Based.rar
    71.4 KB · Views: 133
  • SS1.png
    SS1.png
    159.4 KB · Views: 146
@baileychic
thank you for your work
it worked great for you tho i'm unable to work it here cause im having troubls with proteus 8.9 sp0
i'm using the 8.6 version and unable to download 8.9
thank you tho

- - - Updated - - -

Okay, Susan.

@AboudaKing.

Fixed project attached.

There were two issues.

One is Proteus Virtual Terminaal cannot accept CR and LF (0x0D, 0x0A).
2nd is you were using this function

Code:
Soft_UART_Init([color=blue]&[/color]PORTC,7,6,9600,0); // TX=RC6, RX=RC7, Baud=9600

as

Code:
Soft_UART_Init(PORTC,7,6,9600,0); // TX=RC6, RX=RC7, Baud=9600

The '&' was missing in the function call.

You need Proteus 8.9 SP0 to open my file. Older versions of Proteius will not open it. Or refer included PDF file or attached image to correct the UART polarity for your simulation file.

about the first problem "Virtual Terminaal cannot accept CR and LF (0x0D, 0x0A)"
what do you mean i dont realy get it
 

about the first problem "Virtual Terminaal cannot accept CR and LF (0x0D, 0x0A)"
what do you mean i dont realy get it

You have used ENTER key in the code. CR = Carriage return and LF = Line feed and Ascii characters are 0x0D (13) and 0x0A (10).

Ihave replaced your Enter key #define to '.' character.
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top