serin trouble with PIC16F877A


Closed Thread
Results 1 to 20 of 20

Hybrid View

  1. #1
    Join Date
    Jun 2009
    Location
    Sc*nthorpe, UK
    Posts
    333


    Did you find this post helpful? Yes | No

    Default Re: serin trouble with PIC16F877A

    Serin RX, 2, 500, MainMenu, cereal

    This line goes to MainMenu if nothing is received after 500 ms therefore [00]Dingleberry will only be printed if something is received.

    What is going on?

    Can you send the whole code again please?

  2. #2


    Did you find this post helpful? Yes | No

    Default Re: serin trouble with PIC16F877A

    you are correct. However, when that didnt work, I removed it again. But when its there, it just cycles back (basically blinks) to the Main Menu unless you send a keystroke, in which case you get [00]Dingleberry.

    [00] is Null is it not? Is it possible somewhere in the serin process it's trying to take the char before or after my keystroke? I tried 11, and 23 tho and still returns [00] even though 11 and 23 showed on the receiving terminal. I even tried it with a wait command llike wait for "A" then take the next char. Still same thing. And that was straight from the PBP manual....

    #CONFIG
    __config _FOSC_HS & _WDT_OFF & _PWRTE_ON & _BODEN_ON & _LVP_OFF & _CPD_OFF & _WRT_OFF & _DEBUG_OFF & _CP_OFF
    #ENDCONFIG

    TRISC=%10000000
    DEFINE OSC 12

    el var PORTD.7
    TRISD.7 = 0
    low el
    az var PORTB.5
    TRISB.5 = 0
    low az
    dir var PORTD.5
    TRISD.5 = 0
    low dir
    TX var PORTC.6
    TRISC.6 = 0
    RX var PORTC.7


    CNT var word
    cereal var byte
    i var byte


    goto MainMenu


    CLR:
    For i = 0 to 30
    serout TX, 2, [10]
    next i
    return


    MainMenu:
    gosub CLR
    serout Tx, 2, ["******** MAIN MENU ********", 13, 10, 10]
    serout Tx, 2, [" 1. Start Homing Sequence", 13, 10]
    serout Tx, 2, [" 2. Manual JOG Mode", 13, 10]
    serout Tx, 2, [" 3. Auto-Acquire Satellite", 13, 10]
    serout Tx, 2, [" 4. Stow Dish for Travel", 13, 10, 10]
    serout Tx, 2, ["Enter Your Selection:", 13, 10]
    pause 500
    Serin RX, 2, 500, MainMenu, cereal

    If cereal = "1" then goto HomeDish
    If cereal = "2" then goto JogMenu
    If cereal = "3" then goto AutoAcquire
    If cereal = "4" then goto StowDish
    serout TX, 2, [cereal] 'For debugging only
    serout TX, 2, ["Dingleberry"]
    pause 1500
    goto MainMenu


    HomeDish:
    gosub CLR
    serout Tx, 2, ["******** HOME DISH ********", 13, 10, 10]
    serout Tx, 2, [" 1. Start Homing Sequence", 13, 10, 10]
    serout Tx, 2, [" 2 Abort Homing", 13, 10, 10]
    serout Tx, 2, ["Enter Your Selection:", 13, 10]
    Serin RX, 2, cereal
    if cereal = "1" then goto StartHoming
    if cereal = "2" then goto MainMenu
    serout TX, 2, [cereal] 'For debugging only
    pause 500
    goto HomeDish


    JogMenu:
    gosub CLR
    serout TX, 2, [" JOG MENU ", 13, 10, 10]
    serout TX, 2, ["1. Elevation", 13, 10]
    serout tx, 2, ["2. Azimuth", 13, 10]
    serout tx, 2, ["3. Skew", 13, 10]
    serout tx, 2, ["4. Main Menu", 13, 10, 10]
    serout tx, 2, ["Enter Your Selection:"]
    serin RX, 2, cereal
    goto MainMenu


    AutoAcquire:
    gosub CLR
    serout TX, 2, [" AUTO-ACQUIRE ", 13, 10, 10]
    serout TX, 2, ["*** UNDER CONSTRUCTION *** ", 13, 10]
    pause 3000
    goto MainMenu


    StowDish:
    gosub CLR
    serout TX, 2, [" STOW DISH ", 13, 10, 10]
    serout TX, 2, ["*** UNDER CONSTRUCTION *** ", 13, 10]
    pause 3000
    goto MainMenu


    StartHoming:
    gosub CLR
    serout TX, 2, [" Begin Homing, Homie ", 13, 10, 10]
    serout TX, 2, ["*** UNDER CONSTRUCTION *** ", 13, 10]
    pause 3000
    goto MainMenu

    TestPattern:
    HIGH el
    pause 1000
    low el
    pause 1000
    high dir
    pause 50
    high el
    pause 1000
    low el
    low dir
    pause 1000
    HIGH az
    pause 1000
    low az
    pause 1000
    high dir
    pause 50
    high az
    pause 1000
    low az
    low dir
    pause 1000
    goto TestPattern

Similar Threads

  1. Having trouble with SERIN command and MAX6675
    By emerson in forum mel PIC BASIC Pro
    Replies: 39
    Last Post: - 16th April 2017, 19:48
  2. Control de puertos PIC16F877A / Port Control PIC16F877A
    By martintorres in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 4th October 2013, 03:49
  3. i'm in trouble...help me please...
    By texas5 in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 25th September 2008, 19:50
  4. Trouble with P.W.M
    By Muller in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 8th April 2008, 21:18
  5. Replies: 9
    Last Post: - 4th February 2008, 19:12

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