1. 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.
    Dismiss Notice

Serial comm between uC and PC...

Discussion in 'Microcontrollers' started by koolguy, Apr 26, 2013.

  1. misterT

    misterT Well-Known Member Most Helpful Member

    Joined:
    Apr 19, 2010
    Messages:
    2,697
    Likes:
    368
    Location:
    Finland
    Call your college and ask your money back.
     
  2. koolguy

    koolguy Active Member

    Joined:
    Aug 24, 2010
    Messages:
    2,196
    Likes:
    9
    Why college i have buy it from Robokits india the whole USB module you can see in previous post...
    please tell what changes to do for using it????
     
  3. misterT

    misterT Well-Known Member Most Helpful Member

    Joined:
    Apr 19, 2010
    Messages:
    2,697
    Likes:
    368
    Location:
    Finland
    Ok. If you want help, post full schematics and all the code you have done so far. Without those I can't do anything to help you.
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. koolguy

    koolguy Active Member

    Joined:
    Aug 24, 2010
    Messages:
    2,196
    Likes:
    9

    This the code drawing schematic....


    Code (text):
    #include <htc.h>
    __CONFIG(LVP_OFF & BOREN_OFF & PWRTE_ON & WDTE_OFF & FOSC_HS);
    #define _XTAL_FREQ 20000000





    unsigned char  HSerin(void);
    void HSerout(unsigned char ch), HSerinit(void);
     
    void main(void)                     // program entry
        {
        int index = 0;
        unsigned char ch;
        ADCON1 = 0x6;                   // Analogue off                
        HSerinit();
           __delay_ms(150);
        while(1)                        // endless Loop
            {
            ch = HSerin();              // wait for a character
            HSerout(ch);                // Echo back
     
            }
        }
     
    void HSerinit()
     
    Last edited: May 14, 2013
  6. misterT

    misterT Well-Known Member Most Helpful Member

    Joined:
    Apr 19, 2010
    Messages:
    2,697
    Likes:
    368
    Location:
    Finland
    Why two different codes?
     
  7. koolguy

    koolguy Active Member

    Joined:
    Aug 24, 2010
    Messages:
    2,196
    Likes:
    9
    Where to draw schematic i have orcad 16.5 installed but some problem is there will drawing i am new to it still working on it!!
     
  8. koolguy

    koolguy Active Member

    Joined:
    Aug 24, 2010
    Messages:
    2,196
    Likes:
    9
    I have used both for echo back and second for writing from uC to PC terminal window i have tested both but nothing is working!!
     
  9. misterT

    misterT Well-Known Member Most Helpful Member

    Joined:
    Apr 19, 2010
    Messages:
    2,697
    Likes:
    368
    Location:
    Finland
    You need to calm down and test more! Try to find out is the hardware ok. Then read the microcontroller datasheet and and check your USART settings. Read the datasheet. Study how the USART works.
     
  10. koolguy

    koolguy Active Member

    Joined:
    Aug 24, 2010
    Messages:
    2,196
    Likes:
    9

    Yes it is working fine i have used many times using 20Mhz with 12pf parallel with 15pf....at both sides....
     
  11. misterT

    misterT Well-Known Member Most Helpful Member

    Joined:
    Apr 19, 2010
    Messages:
    2,697
    Likes:
    368
    Location:
    Finland
  12. koolguy

    koolguy Active Member

    Joined:
    Aug 24, 2010
    Messages:
    2,196
    Likes:
    9
    Yes, when i have connected the RX to TX of USB the text was comming back to terminal window..

    here is the schematic!
     

    Attached Files:

  13. misterT

    misterT Well-Known Member Most Helpful Member

    Joined:
    Apr 19, 2010
    Messages:
    2,697
    Likes:
    368
    Location:
    Finland
    What PIC are you actually using? Your compiler says "--chip=16F877A ", but your schematic says 16F873

    Read the datasheet and check your code. Every setting you make.. you need to go through it and check everything using the datasheet.
     
  14. koolguy

    koolguy Active Member

    Joined:
    Aug 24, 2010
    Messages:
    2,196
    Likes:
    9
    I am using pic16f877a only but in orcad it was not there!
     
  15. misterT

    misterT Well-Known Member Most Helpful Member

    Joined:
    Apr 19, 2010
    Messages:
    2,697
    Likes:
    368
    Location:
    Finland
    Yeah.. thanks for the incorrect schematics very helpful. You draw that **** just for me? thanks alot.

    I see what your problem is. You don't even care enough to send proper schematics. I can't waste my time for this if you are too lazy to provide proper information.
     
  16. koolguy

    koolguy Active Member

    Joined:
    Aug 24, 2010
    Messages:
    2,196
    Likes:
    9
    What is the problem in it??
     
  17. blueroomelectronics

    blueroomelectronics Well-Known Member

    Joined:
    Jan 21, 2007
    Messages:
    12,536
    Likes:
    170
    Location:
    Toronto, Canada
    Possibly the best advice ever given in these forums.
     
    • Like Like x 2
  18. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,869
    Likes:
    144
    Location:
    morristown,tn
    Code for a 16f873a will run on a 16f877a there the same core but the 16f877a has more pins so it may not work for the 28 pin chip if you don't watch ports.
     
  19. tunedwolf

    tunedwolf Well-Known Member

    Joined:
    Aug 9, 2006
    Messages:
    1,080
    Likes:
    62
    Location:
    UK
    Sheesh, I have read and re-read this thread...all I can say is it reminds me of a service call to Vodafo**
    Right from the off you know where's it's going, but you just have to follow along anyway for the pain of it :D
     
  20. koolguy

    koolguy Active Member

    Joined:
    Aug 24, 2010
    Messages:
    2,196
    Likes:
    9
    Hi,
    The code is for 877 in schematic was drawn in Orcad so, there was no 877 in library file that why for showing i have it ......
     
  21. DerStrom8

    DerStrom8 Super Moderator Most Helpful Member

    Joined:
    Aug 9, 2010
    Messages:
    5,512
    Likes:
    507
    Location:
    Vermont (GMT-5:00)
    PICs are NOT interchangeable. You MUST check the pinouts and rewire them if necessary. Otherwise nothing will work.


    . . . . . .. . . . . . . . . . . ,.-‘”. . . . . . . . . .``~.,
    . . . . . . . .. . . . . .,.-”. . . . . . . . . . . . . . . . . .“-.,
    . . . . .. . . . . . ..,/. . . . . . . . . . . . . . . . . . . . . . . ”:,
    . . . . . . . .. .,?. . . . . . . . . . . . . . . . . . . . . . . . . . .\,
    . . . . . . . . . /. . . . . . . . . . . . . . . . . . . . . . . . . . . . ,}
    . . . . . . . . ./. . . . . . . . . . . . . . . . . . . . . . . . . . ,:`^`.}
    . . . . . . . ./. . . . . . . . . . . . . . . . . . . . . . . . . ,:”. . . ./
    . . . . . . .?. . . __. . . . . . . . . . . . . . . . . . . . :`. . . ./
    . . . . . . . /__.(. . .“~-,_. . . . . . . . . . . . . . ,:`. . . .. ./
    . . . . . . /(_. . ”~,_. . . ..“~,_. . . . . . . . . .,:`. . . . _/
    . . . .. .{.._$;_. . .”=,_. . . .“-,_. . . ,.-~-,}, .~”; /. .. .}
    . . .. . .((. . .*~_. . . .”=-._. . .“;,,./`. . /” . . . ./. .. ../
    . . . .. . .\`~,. . ..“~.,. . . . . . . . . ..`. . .}. . . . . . ../
    . . . . . .(. ..`=-,,. . . .`. . . . . . . . . . . ..(. . . ;_,,-”
    . . . . . ../.`~,. . ..`-.. . . . . . . . . . . . . . ..\. . /\
    . . . . . . \`~.*-,. . . . . . . . . . . . . . . . . ..|,./.....\,__
    ,,_. . . . . }.>-._\. . . . . . . . . . . . . . . . . .|. . . . . . ..`=~-,
    . .. `=~-,_\_. . . `\,. . . . . . . . . . . . . . . . .\
    . . . . . . . . . .`=~-,,.\,. . . . . . . . . . . . . . . .\
    . . . . . . . . . . . . . . . . `:,, . . . . . . . . . . . . . `\. . . . . . ..__
    . . . . . . . . . . . . . . . . . . .`=-,. . . . . . . . . .,%`>--==``
    . . . . . . . . . . . . . . . . . . . . _\. . . . . ._,-%. . . ..`
     

Share This Page