SEROUT Just Garbage!


Closed Thread
Results 1 to 37 of 37

Hybrid View

  1. #1
    Join Date
    Aug 2006
    Posts
    91


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e
    you don't need those
    DEFINE CHAR_PACING 1000
    DEFINE OSC 4
    OPTION_REG.7 = 0 ' gpio 0 - 2 digital
    WPU = 255 ' week pull ups on all pins


    AND you must set the OSCCAL to get accuracy with SEROUT. I hope your OSCCAL is not erase as now...

    at the end your code will look like this.


    Code:
    @ __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _PWRTE_ON & _MCLRE_OFF & _BODEN_ON
        ' Internal Oscillator
        ' Enable watch dog timer
        ' Enable power up timer
        ' Disable MCLR pin
        ' Enable brown out detect
    DEFINE OSCCAL_1K 1
    INCLUDE "modedefs.bas"
    TRISIO.0 = 0 ' set GPIO.0 as output
    CMCON = 7 ' turn off analog comparator
    
    Pause 200 ' Allow pic to Stabilize 
    
    loop:
    
    SerOut GPIO.0,N2400,["Hello World"]
    Pause 1000
    SerOut GPIO.0,N2400,["abc",13,10]
    Pause 4000
    GoTo loop
    and this one is working @2400 baud

    The most important thing here is to set the OSCCAL at the begining.

    hope this help you

    Im trying to connect a 12F675 to my machine to test it out but I get nothing in hyperterm.
    Have
    +5 to pin 1
    1K resistor on pin 7 connected to pin 2 on DB9
    Ground on pin 8
    and a 0.1uF from pin 1 to 8.
    pin 5 on DB9 to ground.

    Do I connect first on hyper term or power the chip up first? what setting should I have?

    Thanks

    Using the above code and as 12F675 I can't get it to send anything.

  2. #2
    Join Date
    Jan 2005
    Posts
    21


    Did you find this post helpful? Yes | No

    Default

    Set up "Hyper term" using "VT100 Emulation".

    Then set the comm port like this
    Bits per sec = 2400
    Data bits =8
    Parity = none
    Stops bits = 1
    Flow control = none

  3. #3
    Join Date
    Aug 2006
    Posts
    91


    Did you find this post helpful? Yes | No

    Default

    Tried that but still nothing

  4. #4
    Join Date
    Jan 2005
    Posts
    21


    Did you find this post helpful? Yes | No

    Default

    Can you post youre code!

  5. #5
    Join Date
    Aug 2006
    Posts
    91


    Did you find this post helpful? Yes | No

    Default

    I thought that was you that asked me for it. I emailed it to someone.
    Here it is I had added a led to it just to make sure the chip was actually working but here it is.

    Code:
    '12F675
    @ __CONFIG _INTRC_OSC_NOCLKOUT & _WDT_ON & _PWRTE_ON & _MCLRE_OFF & _BODEN_ON
    
    TRISIO.0 = 0   'Set GPIO.0 to output.
    ANSEL.0 = 0    'Set GPIO.0 to digital		
    GPIO.0 = 0
    CMCON = 7 ' PortA Digital inputs
    VRCON = 0        ' Voltage reference disabled
    OPTION_REG.7 =    0
    
    DEFINE OSCCAL_1K 1
    INCLUDE "modedefs.bas"
    
    
    led2 var GPIO.1
    
    loop:
    
    SerOut GPIO.0,N2400,["Hello World"]
    Pause 1000
    SerOut GPIO.0,N2400,["abc",13,10]
    Pause 4000
    
    high LED2
    pause 500
    LOW LED2
    pause 500
    high LED2
    pause 500
    LOW LED2
    pause 500
    GoTo loop

  6. #6
    Join Date
    Jan 2005
    Posts
    21


    Did you find this post helpful? Yes | No

    Default

    I Think your Oscal might be off or Lost!
    Try this code below to see.

    'Lost oscal recover program
    ' Use Hyper_Term settings "9600 N,8,1"
    '
    @ DEVICE pic12F675
    @ DEVICE pic12F675, INTRC_OSC_NOCLKOUT
    @ DEVICE pic12F675, WDT_OFF
    @ DEVICE pic12F675, MCLR_OFF
    @ DEVICE pic12F675, CPD_OFF
    @ DEVICE pic12F675, BOD_OFF
    @ DEVICE pic12F675, PWRT_ON
    @ DEVICE pic12F675, PROTECT_OFF
    SO VAR GPIO.0 ' serial out pin

    ANSEL = 0 ' disable converters
    CMCON = 7 ' disable comparators

    OSCCAL = 0 ' starting value

    Pause 2000

    loop:
    OSCCAL = OSCCAL + $10 ' increment calibration value
    SerOut2 SO,16468,[HEX2 OSCCAL, " This is a close OSC Value!",10,13] ' Display the hex value

    Pause 750 ' give time to read the value
    GoTo loop ' do it forever

  7. #7
    Join Date
    Aug 2006
    Posts
    91


    Did you find this post helpful? Yes | No

    Default

    Ok I had to make a chane to get it to compile mine doesn't like how you did the defines but here it is
    @ __CONFIG _INTRC_OSC_NOCLKOUT & _WDT_ON & _PWRTE_ON & _MCLRE_OFF & _BODEN_ON & _CP_OFF & _CPD_OFF

    SO VAR GPIO.0 ' serial out pin

    ANSEL = 0 ' disable converters
    CMCON = 7 ' disable comparators

    OSCCAL = 0 ' starting value

    Pause 2000

    loop:
    OSCCAL = OSCCAL + $10 ' increment calibration value
    SerOut2 SO,16468,[HEX2 OSCCAL, " This is a close OSC Value!",10,13] ' Display the hex value

    Pause 750 ' give time to read the value
    GoTo loop ' do it forever

    I setup hyperterm with the settings you said and then set it to vt100 as well? its running now will let you know how it does.

Similar Threads

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