Trying to inch my way to the finish line w/ a 16F1829.........


Closed Thread
Results 1 to 40 of 68

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default Re: Trying to inch my way to the finish line w/ a 16F1829.........

    OK. I got multicalc working.
    I got hserout working.
    hserin - notsomuch.

    My menu looks fine in the terminal. (although I can't test it with interrupts firing since I can't respond and mover the dish) But it just sits there and looks at me stupid when I give a command.

    Code:
    '****************************************************************
    '*  Name    : UNTITLED.BAS                                      *
    '*  Author  : [select VIEW...EDITOR OPTIONS]                    *
    '*  Notice  : Copyright (c) 2014 [select VIEW...EDITOR OPTIONS] *
    '*          : All Rights Reserved                               *
    '*  Date    : 6/7/2014                                          *
    '*  Version : 1.0                                               *
    '*  Notes   :                                                   *
    '*          :                                                   *
    '****************************************************************
    INCLUDE "DT_INTS-14.bas"
    INCLUDE "ReEnterPBP.bas"
    
    
    DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
    DEFINE HSER_TXSTA 24h ' Enable transmit, BRGH = 1
    DEFINE HSER_SPBRG 129 ' 9600 Baud @ 20MHz, 0.16%
    DEFINE HSER_CLROERR 1 ' Clear overflow automatically
    APFCON0.2 = 1
    APFCON0.7 = 1
    
    
    #CONFIG
        __config _CONFIG1, _FOSC_HS & _WDTE_OFF & _PWRTE_OFF & _MCLRE_ON & _CP_OFF & _CPD_OFF & _BOREN_OFF &  _CLKOUTEN_OFF & _IESO_OFF
        __config _CONFIG2, _PLLEN_OFF & _LVP_OFF
    #ENDCONFIG
    
    
    DEFINE OSC 20
     
    ANSELA = 0
    ANSELB = 0
    
    
    ASM
    INT_LIST  macro    ; IntSource,        Label,  Type, ResetFlag?
            INT_Handler    INT_INT,  _doEncoder,    PBP,  yes
        endm
        INT_CREATE            ; Creates the interrupt processor
    ENDASM
    @   INT_ENABLE   INT_INT
    
    
    LED var PORTC.7
    TRISC.7 = 0
    LED = 0
    DOWN var PORTB.4
    TRISB.4 = 0
    DOWN = 0
    EAST var PORTB.5
    TRISB.5 = 0
    EAST = 0
    WEST var PORTB.6
    TRISB.6 = 0
    WEST = 0
    TRISC.5 = 1
    UP var PORTB.7
    TRISB.7 = 0
    UP = 0
    
    
    
    
    
    
    a0 var byte
    a1 var byte
    e0 var byte
    e1 var byte
    i var byte
    VerboseMode var byte
    cereal var byte
    Aencoder0Pos var word
    Eencoder0Pos var word
    
    
    
    
    
    
    VerboseMode = 1
    
    
    goto MainMenu
    
    
    
    
    doEncoder:
        if UP = 1 then 
            'if e0 = 5 then 
                Eencoder0Pos = Eencoder0Pos + 1
            '    e0 = 0
                if VerboseMode = 1 then Hserout ["Eencoder0Pos = ", #Eencoder0Pos, 13, 10]
            'endif
            'e0 = e0 + 1
        endif
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          if DOWN = 1 then 
            'if e1 = 5 then 
                Eencoder0Pos = Eencoder0Pos - 1
            '    e1 = 0
                if VerboseMode = 1 then Hserout ["Eencoder0Pos = ", #Eencoder0Pos, 13, 10]
            'endif
            'e1 = e1 + 1
        endif
        if EAST = 1 then 
            if a0 = 5 then 
                Aencoder0Pos = Aencoder0Pos + 1
                A0 = 0
                if VerboseMode = 1 then Hserout ["Aencoder0Pos = ", #Aencoder0Pos, 13, 10]
            endif
            a0 = a0 + 1
        endif
        if WEST = 1 then 
            if a1 = 5 then 
                Aencoder0Pos = Aencoder0Pos - 1
                a1 = 0
                if VerboseMode = 1 then Hserout ["Aencoder0Pos = ", #Aencoder0Pos, 13, 10]
            endif
            a1 = a1 + 1
        endif
    @ INT_RETURN
    
    
    
    
    MainMenu:
        gosub CLR
        HSEROUT ["******** MAIN MENU ********", 13, 10, 10]
        HSEROUT [" 1. Start Homing Sequence", 13, 10]
        HSEROUT [" 2. Manual JOG Mode", 13, 10]
        HSEROUT [" 3. Auto-Acquire Satellite", 13, 10]
        HSEROUT [" 4. Stow Dish for Travel", 13, 10, 10]
        HSEROUT ["Enter Your Selection:"]
        hSERIN [cereal]
        if VerboseMode = 1 then HSEROUT [#cereal,13,10]
    '    If cereal = "1" then goto HomeDish 
        If cereal = "2" then goto JogMenu
    '    If cereal = "3" then goto TEST1
    '    If cereal = "4" then goto Startup
    goto MainMenu
    
    
    JogMenu:
        gosub CLR
        pause 250
        HSEROUT ["***** JOG MENU *****", 13, 10, 10]
        HSEROUT ["U - UP", 13, 10]
        HSEROUT ["D - DOWN", 13, 10]
        HSEROUT ["E - EAST", 13, 10]
        HSEROUT ["W - WEST", 13, 10]
        HSEROUT ["S - ALL STOP", 13, 10]
        HSEROUT ["X - MAIN MENU", 13, 10, 10]
        hSERIN [cereal]
        if cereal = "U" Then
            gosub allSTOP
            HIGH UP
        endif
        if cereal = "D" then
            gosub allSTOP
            HIGH DOWN
        endif
        if cereal = "E" then
            gosub allSTOP
            high EAST
        endif
        if cereal = "W" then
            gosub allSTOP
            HIGH WEST
        endif
        if cereal = "S" then gosub allSTOP
        if cereal = "X" then 
            gosub allSTOP
            goto MainMenu
        endif
    goto JOGMenu
    
    
    allSTOP:
        EAST = 0
        UP = 0
        DOWN = 0
        WEST = 0
        if VerboseMode = 1 then GOSUB POS
    return
    
    
    CLR:
        if VerboseMode = 0 then
            For i = 0 to 30
                HSEROUT [10]
            next i
        endif
    return
    
    
    abort:
        gosub allSTOP
        gosub clr
        HSEROUT ["USER STOP! -- MOVE ABORTED!", 13, 10]
        PAUSE(5000)
    goto MainMenu
    
    
    moveerror:
        gosub allSTOP
        gosub clr
        HSEROUT ["SYSTEM ERROR! -- MOVE ABORTED!", 13, 10]
        PAUSE(5000)
    goto MainMenu
    
    
    POS:
        pause 100
        HSEROUT ["  EL -- ", #Eencoder0Pos, "  AZ -- ", #Aencoder0Pos, 13, 10]
        pause 2000
    return

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


    Did you find this post helpful? Yes | No

    Default Re: Trying to inch my way to the finish line w/ a 16F1829.........

    Are you saying these lines do not execute?

    hSERIN [cereal]
    if VerboseMode = 1 then HSEROUT [#cereal,13,10]

  3. #3


    Did you find this post helpful? Yes | No

    Default Re: Trying to inch my way to the finish line w/ a 16F1829.........

    • Are you saying these lines do not execute?

      hSERIN [cereal]
      if VerboseMode = 1 then HSEROUT [#cereal,13,10]

      correct


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


    Did you find this post helpful? Yes | No

    Default Re: Trying to inch my way to the finish line w/ a 16F1829.........

    Quote Originally Posted by thasatelliteguy View Post
    • Are you saying these lines do not execute?

      hSERIN [cereal]
      if VerboseMode = 1 then HSEROUT [#cereal,13,10]

      correct

    HSERIN is not receiving anything then?

  5. #5


    Did you find this post helpful? Yes | No

    Default Re: Trying to inch my way to the finish line w/ a 16F1829.........

    Quote Originally Posted by EarlyBird2 View Post
    HSERIN is not receiving anything then?
    that's correct

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


    Did you find this post helpful? Yes | No

    Default Re: Trying to inch my way to the finish line w/ a 16F1829.........

    The issue has nothing to do with HSERIN or the program. As you have a MAX232 could you connect direct to your PC and use HyperTerminal to test the functioning?

Similar Threads

  1. Replies: 2
    Last Post: - 31st May 2013, 18:19
  2. line truncate...again
    By queenidog in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 12th March 2012, 21:58
  3. Most Users Ever On-Line
    By skimask in forum Off Topic
    Replies: 1
    Last Post: - 26th April 2007, 19:06
  4. 2 Line Chars on a 2 Line LCD
    By Squibcakes in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 16th November 2003, 00:44

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