+ Post New Thread
Results 1 to 17 of 17
  1. #1
    Newbie level 5
    Points: 42, Level: 1

    Join Date
    May 2019
    Posts
    9
    Helped
    0 / 0
    Points
    42
    Level
    1

    SOFT_UART pic18f452 serial communication

    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 ?

    Click image for larger version. 

Name:	1.png 
Views:	12 
Size:	137.3 KB 
ID:	153232
    uart.txt
    programme.txt

  2. #2
    Super Moderator
    Points: 79,067, Level: 68
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    16,051
    Helped
    3635 / 3635
    Points
    79,067
    Level
    68

    Re: SOFT_UART pic18f452 serial communication

    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
    Please dont contact me via PM, because there is no time to respond to them. No friend requests. Thank you.


    1 members found this post helpful.

    •   AltAdvertisement

        
       

  3. #3
    Newbie level 5
    Points: 42, Level: 1

    Join Date
    May 2019
    Posts
    9
    Helped
    0 / 0
    Points
    42
    Level
    1

    Re: SOFT_UART pic18f452 serial communication

    Quote Originally Posted by KlausST View Post
    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



  4. #4
    Advanced Member level 2
    Points: 3,283, Level: 13
    baileychic's Avatar
    Join Date
    Aug 2017
    Posts
    651
    Helped
    50 / 50
    Points
    3,283
    Level
    13

    Re: SOFT_UART pic18f452 serial communication

    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.



  5. #5
    Newbie level 5
    Points: 42, Level: 1

    Join Date
    May 2019
    Posts
    9
    Helped
    0 / 0
    Points
    42
    Level
    1

    Re: SOFT_UART pic18f452 serial communication

    Quote Originally Posted by baileychic View Post
    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



    •   AltAdvertisement

        
       

  6. #6
    Advanced Member level 2
    Points: 3,283, Level: 13
    baileychic's Avatar
    Join Date
    Aug 2017
    Posts
    651
    Helped
    50 / 50
    Points
    3,283
    Level
    13

    Re: SOFT_UART pic18f452 serial communication

    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?



    •   AltAdvertisement

        
       

  7. #7
    Super Moderator
    Points: 79,067, Level: 68
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    16,051
    Helped
    3635 / 3635
    Points
    79,067
    Level
    68

    Re: SOFT_UART pic18f452 serial communication

    Hi,

    Why do you use software UART instead of hardware UART?

    Klaus
    Please dont contact me via PM, because there is no time to respond to them. No friend requests. Thank you.



  8. #8
    Super Moderator
    Points: 82,003, Level: 69
    Achievements:
    7 years registered
    Awards:
    2nd Helpful Member
    betwixt's Avatar
    Join Date
    Jul 2009
    Location
    Aberdyfi, West Wales, UK
    Posts
    13,450
    Helped
    4487 / 4487
    Points
    82,003
    Level
    69

    Re: SOFT_UART pic18f452 serial communication

    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.
    PLEASE - no friends requests or private emails, I simply don't have time to reply to them all.
    It's better to share your questions and answers on Edaboard so we can all benefit from each others experiences.



  9. #9
    Newbie level 5
    Points: 42, Level: 1

    Join Date
    May 2019
    Posts
    9
    Helped
    0 / 0
    Points
    42
    Level
    1

    Re: SOFT_UART pic18f452 serial communication

    Quote Originally Posted by baileychic View Post
    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



  10. #10
    Advanced Member level 2
    Points: 3,283, Level: 13
    baileychic's Avatar
    Join Date
    Aug 2017
    Posts
    651
    Helped
    50 / 50
    Points
    3,283
    Level
    13

    Re: SOFT_UART pic18f452 serial communication

    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.



  11. #11
    Newbie level 5
    Points: 42, Level: 1

    Join Date
    May 2019
    Posts
    9
    Helped
    0 / 0
    Points
    42
    Level
    1

    Re: SOFT_UART pic18f452 serial communication

    here is the project
    proteus+mikroC



  12. #12
    Advanced Member level 2
    Points: 3,283, Level: 13
    baileychic's Avatar
    Join Date
    Aug 2017
    Posts
    651
    Helped
    50 / 50
    Points
    3,283
    Level
    13

    Re: SOFT_UART pic18f452 serial communication

    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.



  13. #13
    Newbie level 5
    Points: 42, Level: 1

    Join Date
    May 2019
    Posts
    9
    Helped
    0 / 0
    Points
    42
    Level
    1

    Re: SOFT_UART pic18f452 serial communication

    Quote Originally Posted by baileychic View Post
    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



  14. #14
    Advanced Member level 4
    Points: 7,900, Level: 21

    Join Date
    Jan 2015
    Posts
    1,108
    Helped
    348 / 348
    Points
    7,900
    Level
    21

    Re: SOFT_UART pic18f452 serial communication

    @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



    •   AltAdvertisement

        
       

  15. #15
    Advanced Member level 2
    Points: 3,283, Level: 13
    baileychic's Avatar
    Join Date
    Aug 2017
    Posts
    651
    Helped
    50 / 50
    Points
    3,283
    Level
    13

    Re: SOFT_UART pic18f452 serial communication

    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(&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.


    1 members found this post helpful.

  16. #16
    Newbie level 5
    Points: 42, Level: 1

    Join Date
    May 2019
    Posts
    9
    Helped
    0 / 0
    Points
    42
    Level
    1

    Re: SOFT_UART pic18f452 serial communication

    @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 - - -

    Quote Originally Posted by baileychic View Post
    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(&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



  17. #17
    Advanced Member level 2
    Points: 3,283, Level: 13
    baileychic's Avatar
    Join Date
    Aug 2017
    Posts
    651
    Helped
    50 / 50
    Points
    3,283
    Level
    13

    Re: SOFT_UART pic18f452 serial communication

    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.


    1 members found this post helpful.

--[[ ]]--