serout pic16f84 different than pic16f818


Results 1 to 7 of 7

Threaded View

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


    Did you find this post helpful? Yes | No

    Default

    Joe it's perfectly usual to set the Serial pin to it's normal state. When you start the PIC and just set the TRIS register, you couldn't know at which level they will be.

    Here there's no TRIS setting, but HIGH take care of it. Too bad, it will need LOW instead for Inverted mode.

    Do a simple test with that Code, monitor the PORTB.0 level before the SEROUT, and after the SEROUT. There's chance it will be different, thus this may 'fart' the First data you send.

    Another thing, this PIC have a nice OSCCON register that allow you to know when the internal OSC is stable. You should wait until it is stable unless you may again screw the baudrate.

    Again, it use a internal OSC which are usually pretty poor for any reliable serial communication. At least you should tune it by changing the OSCTUNE register value. Why it worked with a F84... because of the EXTERNAL osc.

    If you have only 1 serial output, There's no advantage to use SEROUT, you should try DEBUG.

    PBP SLEEP use the WatchdogTimer, and you don't have it enable in your config fuses. So i doubt it may work UNLESS you haven't comment the PBP default in the PBP .INC file. WhyNot using PAUSE instead?

    For safety sake, you should wait at little bit after you set the SerialPinIdle level, let's say 50mSec

    try this untested one
    Code:
            ASM
            DEVICE PIC16F818, INTRC_OSC ,MCLR_OFF   ,LVP_OFF
            DEVICE PIC16F818, WDT_ON    ,PWRT_ON    ,BOD_ON
            DEVICE PIC16F818, DEBUG_OFF ,CCPMX_OFF
            DEVICE PIC16F818, CPD_OFF   ,WRT_OFF    ,PROTECT_OFF     
            ENDASM   
    
            '
            '       Internal OSC config
            '       ====================
            OSCCON=$60                  ' Internal OSC=4MHZ
            WHILE OSCCON.2=0 : WEND     ' wait until frequency is stable
    
            '
            '       I/O config
            '       ==========
            TRISB=0                     ' PORTB=out
            TRISA=0                     ' PORTA=out
            
            ADCON1=6                    ' disable ADCs
    
            '
            '       Softare Serial comm setup
            '       =========================
            DEFINE DEBUG_REG PORTB      ' Debug pin port 
            DEFINE DEBUG_BIT 0          ' Debug pin bit 
            DEFINE DEBUG_BAUD 2400      ' Debug baud rate 
            DEFINE DEBUG_MODE 1         ' Debug mode: 0 = True, 1 = Inverted 
            DEFINE DEBUG_PACING 1000    ' Debug character pacing in us 
    
            
            '               
            '                       Program Start
            '                       =============
            
            
            '
            '       Hardware init
            '       =============
            PORTA=0                     ' clear PORTA
            PORTB=0                     ' clear PORTB
            pause 50                    ' safe statup delay
            
    Start:  
            debug "Text or data, or whatever else written in PBP manual"
            PAUSE 250
            GOTO START
    Last edited by mister_e; - 11th March 2007 at 10:32.
    Steve

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

Similar Threads

  1. A Serial GLCD 128x64 Simple Project
    By Oldspring in forum Off Topic
    Replies: 0
    Last Post: - 8th March 2010, 20:58
  2. Serout to serial servo
    By azmax100 in forum mel PIC BASIC Pro
    Replies: 20
    Last Post: - 12th August 2009, 16:46
  3. Advice-scrutiny for my serial controller
    By kevlar129bp in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 13th December 2008, 17:11
  4. Keypad unlock (as in garage door possibly)
    By Fred in forum Code Examples
    Replies: 5
    Last Post: - 2nd April 2006, 04:26
  5. Replies: 11
    Last Post: - 13th July 2005, 19:26

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