serin trouble with PIC16F877A


Closed Thread
Results 1 to 20 of 20

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default Re: serin trouble with PIC16F877A

    Man! I know this has to be something crazy simple to fix. This was the basis of my very first PIC project 6 weeks ago when I used a PICaxe 20M2 to build a BT controlled tank to pull wire under houses. It worked beautifully! But alas, PICAXE is a lil different from PBP, and I wiped the bootloader from that chip as soon as I got my picKIT3. It sux too cuz I want my tank running again and I cant do that either until I solve this same issue.......

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


    Did you find this post helpful? Yes | No

    Default Re: serin trouble with PIC16F877A

    Quote Originally Posted by thasatelliteguy View Post
    Man! I know this has to be something crazy simple to fix. This was the basis of my very first PIC project 6 weeks ago when I used a PICaxe 20M2 to build a BT controlled tank to pull wire under houses. It worked beautifully! But alas, PICAXE is a lil different from PBP, and I wiped the bootloader from that chip as soon as I got my picKIT3. It sux too cuz I want my tank running again and I cant do that either until I solve this same issue.......
    I agree with you it has to be something simple.

    Cut down the program to the bare minimum and test.

    Code:
    #CONFIG
     __config _FOSC_HS & _WDT_OFF & _PWRTE_ON & _BODEN_ON & _LVP_OFF & _CPD_OFF & _WRT_OFF & _DEBUG_OFF & _CP_OFF
     #ENDCONFIG
    
     DEFINE OSC 12
    
     TX var PORTC.6
     RX var PORTC.7
    
     cereal var byte
     i var byte
     
     For i = 0 to 30
     serout TX, 2, [10]
     next i
     
     MainMenu:
      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]
      Serin RX, 2, 500, MainMenu, cereal
    
      serout TX, 2, [cereal] 'For debugging only
     serout TX, 2, ["Dingleberry"]
     goto MainMenu

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


    Did you find this post helpful? Yes | No

    Default Re: serin trouble with PIC16F877A

    I do not understand how you are getting [00]Dingleberry surely it should be 00Dingleberry.

  4. #4
    Join Date
    Apr 2011
    Location
    Welches, Oregon
    Posts
    198


    Did you find this post helpful? Yes | No

    Default Re: serin trouble with PIC16F877A

    Your comment about getting "[00]Dingleberry" makes me wonder...

    Why would you get two zeros? Your not formatting "cereal" with DEC - or any qualifier. Perhaps you should; perhaps you are getting an ASCII non printing character "printed" to your output (a non-printing character of ASCII value 1 for example)? It seems to me that somewhere, something is happening as the 00 is coming from somewhere.

    You might also try adding a cereal = 65 prior to MainMenu; if you get an "A", then you'll know the serial input is getting nothing in the loop. If you don't... then something is changing the value...

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


    Did you find this post helpful? Yes | No

    Default Re: serin trouble with PIC16F877A

    Amoque,

    I really do not understand the []. Where do they come from?

  6. #6
    Join Date
    Apr 2011
    Location
    Welches, Oregon
    Posts
    198


    Did you find this post helpful? Yes | No

    Default Re: serin trouble with PIC16F877A

    Quote Originally Posted by EarlyBird2 View Post
    Amoque,

    I really do not understand the []. Where do they come from?
    I don't know... I was quoting the OP. If the output is a direct quote, there is much about it I don't understand. Why TWO zeros (in addition to the brackets)? PicBasic doesn't default to double digit display; perhaps the subroutine fails and runs through another subroutine or the WDT causes a second response. Perhaps the brackets were only added for clarity.

    For myself, I think that I'd:

    1) Set a default value for Cereal, so as to know it was changed (or not).
    2) Extend the timeout so that I could be sure that no amount of key-banging elicited an input.
    3) Format the output as DEC or BIN so as to standardize the output.

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, 20:48
  2. Control de puertos PIC16F877A / Port Control PIC16F877A
    By martintorres in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 4th October 2013, 04:49
  3. i'm in trouble...help me please...
    By texas5 in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 25th September 2008, 20:50
  4. Trouble with P.W.M
    By Muller in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 8th April 2008, 22:18
  5. Replies: 9
    Last Post: - 4th February 2008, 20: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