help!!!


Closed Thread
Results 1 to 17 of 17

Thread: help!!!

Hybrid View

  1. #1
    Join Date
    Dec 2005
    Posts
    12

    Lightbulb help!!!

    hey guys i m using the PIC16F84 with 9600 baudrate, no stop bits.
    i just need a code using picbasic pro that takes 8 bites from the port A0 of the PIC and outpot them as bits on b0 through B7
    the microcontroller is acting like a serial to parallel converter!

    so can u plz provide me with the code?

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    are your sure of you protocol?
    i m using the PIC16F84 with 9600 baudrate, no stop bits
    What about...
    Code:
    TRISA=255
    TRISB=0
    DEFINE DEBUGIN_REG PORTA  ' Serial data come in 
    DEFINE DEBUGIN_BIT 0      '     PORTA.0
    DEFINE DEBUGIN_MODE 0     ' true driven mode
    DEFINE DEBUG_BAUD 9600    ' 9600 BAUD
    DataIn var byte
    
    START:
          DEBUGIN DataIn
          PORTB=DaraIn
          goto start
    be sure of your Serial Mode => Inverted or not
    Be sure you also define your OSC speed
    Last edited by mister_e; - 9th January 2006 at 23:13.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3
    Join Date
    Dec 2005
    Posts
    12


    Did you find this post helpful? Yes | No

    Default help!!

    i m using these settings "9600,N,8,1"

  4. #4
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    OK so 9600 Bauds, No Parity, 8 databits, 1 stop bit. The above code should work depending how your data is sent and how you interface your PIC to the external world.

    You may need some Modifiers => look the DEBUGIN section
    You may need to change the Serial mode from True to inverted.

    Keep us inform
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  5. #5
    Join Date
    Dec 2005
    Posts
    12


    Did you find this post helpful? Yes | No

    Default help!!

    i wrote this code but it s not working! so any ideas


    N2400 con 0 'Set Serial mode
    T9600 con 2 ' Set serial mode Baud Rate (T = True)
    VARB0 var BYTE 'Define a variable VARB0 of type byte
    TRISA=$FF 'Set port A to 1 (input)
    TRISB=$00 'Set port B to 0 (output)

    loop:
    Serin PORTA.0,2,VARB0 ' B0 = input character Input the data serially from port A, pin0, at a Baud rate of 9600,
    PORTB = VARB0 'send the data in VARB0 to PORTB (output)

    PAUSE 50 'delay 50ms

    Goto loop ' Forever repeat the loop

    END 'end the program

  6. #6
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Where your data come from?
    Are you using an inverter like MAX232 ?
    Did you connect the PIC Supply GND to the External world GND?
    What is your crystal speed?
    Did you set your config fuse properly?
    Did you tied the MCLR pin to VCC?
    Any schematic or picture of your prototype?
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

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