16f877a serin help!


Closed Thread
Results 1 to 5 of 5
  1. #1
    stu746's Avatar
    stu746 Guest

    Default 16f877a serin help!

    hi I can not get this code to work on a 16f877a, it sends the text to the pc fine but will not recieve anything from the pc!?

    so i tried it on a 16f628 and it worked fine! with everything the same?


    ADCON1 = 7 ' PORTA and E digital


    Include "modedefs.bas" ' Include serial modes

    B0 var byte
    symbol led = portb.2

    high led
    pause 500
    low led
    pause 500
    serout porta.1,396,["READY......"]

    loop: Serin porta.0,396,B0 ' B0 = input character
    If (B0 < "a") or (B0 > "z") Then print ' If lower case, convert to upper
    B0 = B0 - $20
    print: Serout porta.1,396,[B0] ' Send character
    Goto loop ' Forever

  2. #2
    Join Date
    Dec 2003
    Location
    Wichita KS
    Posts
    511


    Did you find this post helpful? Yes | No

    Default

    Hello Stu746,

    Stu>>so i tried it on a 16f628 and it worked fine! with everything the same?


    ADCON1 = 7 ' PORTA and E digital<<

    Take a look at FAQ Serin/Serout.

    Are your ports all outputs?
    TRISB=00000000?
    and TRISA =00000001

    Are you using the correct baudrates (start slow..2400)?.. Inverted? Parity?



    Can you verify your data coming from your PC? Scope it?
    Wrong
    Last edited by Dwayne; - 17th December 2004 at 16:59.
    Ability to Fly:
    Hurling yourself towards the ground, and missing.

    Engineers that Contribute to flying:
    Both optimists and pessimists contribute to the society. The optimist invents the aeroplane, the pessimist the parachute

    Pilots that are Flying:
    Those who know their limitations, and respect the green side of the grass...

  3. #3
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    1. For the 16F628 you would need CMCON = 7 to setup RA as digital. It doesn't hurt to use this with the F877A part either. Even though the F877A POR default is CM2:CM0 = 111 it never hurts to make 100% sure.

    2. You're using the wrong baud mode for SERIN. 396 would be used for SERIN2 @ 2400 bps, driven, true.

    For SERIN you would use mode 0 or --

    Serin porta.0, 0, B0 ' B0 = input character

    Or, since you're already using Include "modedefs.bas" --

    Serin porta.0, T2400, B0 ' B0 = input character
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  4. #4
    stu746's Avatar
    stu746 Guest


    Did you find this post helpful? Yes | No

    Default

    thanks for the replies

    it was a 16f877 i tried first, i just tried with a 16f877a and it worked fine!?

    i will stick to the a version from now

  5. #5
    zikha's Avatar
    zikha Guest


    Did you find this post helpful? Yes | No

    Default

    hi stu.
    i think i am looking for the code you are mentioning. i need to send data from pic16f877a to pc via rf module named RXB4411S-434mhz. you say that it work. would you mind sending me the code for initiating the connection and sending data from the transmitter to receiver. thank you

Similar Threads

  1. PIC16f877 code crosses boundary @800h
    By inventosrl in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 6th April 2009, 22:03
  2. Problem with PBP interrupt and Serin, please help
    By rgregor in forum mel PIC BASIC
    Replies: 0
    Last Post: - 22nd August 2006, 19:02
  3. Clock connection to DS1802 from 16F877A
    By coyotegd in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 3rd January 2006, 18:52
  4. 16F877A serin problem with baud rate 19200
    By leemin in forum Serial
    Replies: 1
    Last Post: - 31st July 2005, 09:45
  5. SerIn and SerOut
    By Dwayne in forum FAQ - Frequently Asked Questions
    Replies: 0
    Last Post: - 21st July 2004, 15:54

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts