need help with "hello world" in hyperterm


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2007
    Posts
    4

    Default need help with "hello world" in hyperterm

    Hello everybody,

    Just getting started with microcontrollers and serial communication, and looking for some advice to diagnose my problem.

    I have a pic 18F4520 connected through a DB9 serial cable, through a keyspan USB/serial adapter.

    I'm trying to get "Hello world", or "Finally working" to print to the screen of hyperterminal.

    my code:

    'TX is connected to pin C6; switch is connected to pin B0

    switchVar var byte
    input portb.0


    Main:
    SwitchVar = portb.0
    if switchvar=1 then
    Serout2 portc.6,16468,["Hello World",10,13]
    endif
    goto main


    I have the settings in hyperterm at 9600,8-N-1.

    my lovely output in hyperterm is the following:

    €øxøøøøøøø€øxøøø€øøø€øxx€øxøøøøøøø€øxøøø€øøø€øxx€ø xøøøøøøø€øxøøø€øøø€øxx


    I've tried many different options, slower baud rates, putting resistors in/out of the transmit line, sending DEC through serout2 .. . .

    Everytime I hit the switch, I get the string of garbage above (albeit consistently the same garbage which I guess is good). When I tried the above options, I get different garbage on the hyperterm, but it is always consistent garbage.

    From looking around on the net, my best guess is that Hyperterminal is receiving binary through the serial port, as people have said that this results in garbage. Not sure how I'm doing it, or if this is even the case.

    Any help appreciated.

    eric

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,531

    Default

    Hi,
    You don't say if you're using a MAX232-type-of-circuit but have you tried:
    Code:
    Serout2 portc.6,84,["Hello World",10,13]
    Make sure you use a X-tal or resonator for the osciallator as the internal oscillator may not be acurate enough.

    /Henrik Olsson.

  3. #3
    Join Date
    Oct 2007
    Posts
    4

    Default no dice: Hellow world->hyperterm

    Quote Originally Posted by HenrikOlsson View Post
    Hi,
    You don't say if you're using a MAX232-type-of-circuit but have you tried:
    Code:
    Serout2 portc.6,84,["Hello World",10,13]
    Make sure you use a X-tal or resonator for the osciallator as the internal oscillator may not be acurate enough.

    /Henrik Olsson.
    Thanks for the response:

    I'm not using a MAX232 device. Tried your the code, with the different logic->spits out different garbage. I am using a 4 Mhz x-tal external that has worked for me with this chip for several other non-serial comm applications. Though I've read that I can't use a 9600 baud rate with this x-tal, I've also tried the same code with different mode #s for 4800 (see below), and run it at 4800 baud in hyper term. It gives me the EXACT same garbage!

    switchVar var byte
    input portb.0


    Main:
    SwitchVar = portb.0
    if switchvar=1 then
    Serout2 portc.6,188,["Hello World A",10,13]
    pause 500
    Serout2 portc.6,16572,["Hello World B",10,13]
    endif
    goto main

    still hopeful,
    eric

  4. #4
    Join Date
    Oct 2007
    Posts
    4

    Default Got it.

    Thanks for the help.

    first time on the forum.

    My code/wiring were correct. But I switched from XT->HS for programming my PIC. It works perfectly now. The tip that the problem could be the oscillator was the tip to put my trouble shooting in the right direction.

    eric

Similar Threads

  1. "hello world" with 18f6680
    By dragons_fire in forum mel PIC BASIC Pro
    Replies: 91
    Last Post: - 6th February 2008, 06:06

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