Help SERIN2/SEROUT2


Closed Thread
Results 1 to 4 of 4

Hybrid View

  1. #1
    Join Date
    Sep 2007
    Posts
    2


    Did you find this post helpful? Yes | No

    Default I've read a bit more..

    Another thing to look at:

    If what I read in the language guide is correct, then your IF..THEN statements are actually branching to a non-existent program label called gosub:

    Is it possible to compile that without raising an error?

    You may have to remove the GOSUBs and the ENDIFs from this bit of code (better make a copy of it lol):

    if cmd = "0" Then
    GOSUB bad
    endif

    if cmd = "1" Then
    GOSUB dosleep
    endif

    if cmd = "2" Then
    GOSUB doend
    endif

    if cmd = "3" Then
    GOSUB getname
    endif

    if cmd = "4" Then
    GOSUB dispname
    endif

    Assuming that the manual is correct, I can see why your blocks of IF..ENDIF are not working (not legal), but I am surprised if the compiler isn't catching that!
    Is it possible that your PIC is resetting when it encounters the first illegal IF..THEN construct? It would explain everything..

  2. #2
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Hi Mike,
    I think you should use the USART and setup a hardware buffer to capture the data choices as I do not believe the code you have will be in the appropriate state when your user is ready to answer the questions, check out Mr. E's keypad routines and the serial backpack code Darrel helped me with. good stuff there. also your main loop simply ends without a directive to goto main so it runs into the subroutines without meeting the criteria your IF THEN loops are asking for. You state hit CR to start the program. The program will simply start and run as is, perhaps a loop to test for a CR is in order so program will not execute beyond the instruction to hit CR until it actually sees a CR.
    something like:
    Code:
    row var byte
    location var byte
    value var byte
    start:             SERIN 1,N2400,ROW,LOCATION,VALUE 
                         IF value = CR then
                          goto main
                           else
                           goto start
    Darn I'm getting rusty at this as I have been working instead of coding . . .
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

Similar Threads

  1. serin2/serout2
    By tazntex in forum Serial
    Replies: 14
    Last Post: - 19th September 2008, 22:01
  2. PIC to PIC "wired" serial one-way communication - SERIN2/SEROUT2
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 14th April 2008, 20:02
  3. Serin2/Serout2 Question
    By scottl in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 18th November 2007, 09:11
  4. Serin2/Serout2 PIC 2 PIC
    By actionplus in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 22nd March 2004, 06:46

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