HSER Problems


Closed Thread
Results 1 to 10 of 10

Thread: HSER Problems

Hybrid View

  1. #1
    Join Date
    Sep 2007
    Posts
    14


    Did you find this post helpful? Yes | No

    Default

    Good day every one!

    I have a new problem now .
    I want a led to be on for 5sec. How ever pause and HSER dont work together. Any sugestions?

    This is the program:

    DEFINE LOADER_USED 1

    DEFINE HSER_TXSTA 24h
    DEFINE HSER_BAUD 2400

    DEFINE OSC 4

    Char VAR BYTE
    LEDB var PORTD.1
    LEDG var PORTD.2
    LEDR VAR PORTD.4

    main:
    GOSUB standby
    LOW LEDB
    HSEROUT [STR char \1]
    HIGH LEDG
    PAUSE 5000
    LOW LEDG
    RCSTA.4 = 0
    RCSTA.4 = 1
    GOTO main

    Standby:
    High ledb
    HSERIN [str char \1]
    RETURN

    Error:
    END

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


    Did you find this post helpful? Yes | No

    Default

    use HSERIN [CHAR] and HSEROUT[CHAR] may solve few things. And you should DEFINE RCSTA as well... even if by default it's 2400 baud. Not sure how DEFINE LOADER_USED affect the whole thing.

    try...
    Code:
    	DEFINE OSC 4
    	DEFINE LOADER_USED 1
    
    	DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
    	DEFINE HSER_TXSTA 20h ' Enable transmit, BRGH = 0
    	DEFINE HSER_SPBRG 25  ' 2400 Baud @ 4MHz, 0.17%
    	DEFINE HSER_CLROERR 1 ' Clear overflow automatically
    
    
    	Char VAR BYTE
    	LEDB var PORTD.1
    	LEDG var PORTD.2
    	LEDR VAR PORTD.4
    
    main:
    	GOSUB standby
    	LOW LEDB
    	HSEROUT [Char]
    	HIGH LEDG
    	PAUSE 5000
    	LOW LEDG
    	GOTO main
    
    Standby:
    	High ledb
    	HSERIN [Char]
    	RETURN
    
    Error:
    	END
    What do you really want to do with the above? Learn something, or doing something useful?
    Last edited by mister_e; - 1st October 2007 at 21:04.
    Steve

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

  3. #3
    Join Date
    Sep 2007
    Posts
    14


    Did you find this post helpful? Yes | No

    Default

    Learn and do something useful. Im doing a school project and its going to be a thing for school also. Every one at our school have "school cards" im are going to do a hmm... You know where you run around in a forest looking for things on a map? Well im are doing the "checkpoints" there. I want so that you only have to use the school card and you will get the information automaticly to the main computer (so you can see time betwen each checkpoint. And time from start to goal.

    Edit: So this is what i want to learn:
    How to get better at pic, electronics, security and RfID.

    And i want to have fun also ofc

  4. #4
    Join Date
    Sep 2007
    Posts
    14


    Did you find this post helpful? Yes | No

    Default

    Also this dont work... I cant use pause, sleep, wait or any function like that because it makes the pic laugh at me

  5. #5
    Join Date
    Sep 2007
    Posts
    14


    Did you find this post helpful? Yes | No

    Default

    bump and /pray

Similar Threads

  1. My USART problems..
    By Glenn in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 31st July 2009, 01:00
  2. 2 PWM in 16F690 problems
    By ciendavila in forum mel PIC BASIC
    Replies: 9
    Last Post: - 27th April 2008, 09:03
  3. bootloader Freqout problems
    By handgio in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 5th December 2007, 13:38
  4. Goto inside a gosub??? Problems...
    By leonel in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 13th October 2005, 12:17
  5. HSEROUT Problems
    By SergioRM in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 7th April 2005, 23:17

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