PIC Basic Code Understanding


Closed Thread
Results 1 to 15 of 15

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default Serial Interrupt Problem

    Hello everyone,

    I m using Picbasic language.

    My problem is: I m sending serially data 2 times from PC and get only 1 time on PIC16Fxx controller.

    I have tried polling method, then i have tried "ON INTERRUPT GOTO label"..... But in both methods i got same problem.

    Actually my code lenth is very long. ... Is it creating a problem?
    Pls giv me solution if anybody find out. I cannot optimize code length....

    Thanks in advance

    with regards
    Kunjan Shah

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    shah_kunjan,
    Please post your code. We would be guessing without it.
    Dave
    Always wear safety glasses while programming.

  3. #3


    Did you find this post helpful? Yes | No

    Default Re:

    Hello Sir,

    My code is too long of about 3000 lines......

    It is not possible to post it here. if u give me ur email id then i can mail u....

    Thank u

    Kunjan

  4. #4
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default try attaching the files

    Quote Originally Posted by shah_kunjan View Post
    Hello Sir,

    My code is too long of about 3000 lines......

    It is not possible to post it here.

    Thank u

    Kunjan
    if you can't attach the file by renaming it as .txt then use winzip or winrar to compress the files and then attach the zip/rar file to a post

  5. #5


    Did you find this post helpful? Yes | No

    Default Re: Code for Serial Interrupt

    Quote Originally Posted by malc-c View Post
    if you can't attach the file by renaming it as .txt then use winzip or winrar to compress the files and then attach the zip/rar file to a post
    Hello Sir,
    i m sending u my code. I m using RS-485 bus network. I m using serial interrupt for 16f876A.
    I m sending serially data 2 times from PC and get only 1 time on PIC16Fxx controller.

    code:

    DEFINE HSER_CLROERR 1
    goto Main

    DEFINE INTHAND myint


    asm
    ; Save W, STATUS and PCLATH registers
    myint
    movwf wsave
    swapf STATUS, W
    clrf STATUS
    movwf ssave
    movf PCLATH, W
    movwf psave

    ; Insert interrupt code here
    ; Save and restore FSR if used
    bsf _LED ; Turn on LED (for example)
    GOTO _Serial

    ; Restore PCLATH, STATUS and W registers
    movf psave, W
    movwf PCLATH
    swapf ssave, W
    movwf STATUS
    swapf wsave, F
    swapf wsave, W
    retfie
    endasm


    '''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''''
    Main:
    LOW LED
    INTCON.6 = 1
    INTCON.7 = 1
    hserout [dec x," ", dec y]
    lcdout $FE,1,#x," ",#y
    here: goto here


    Serial:
    hserin [dec x,dec y]

    ' x = RCREG
    ' y = RCREG

    low led
    goto Main
    'Resume

  6. #6
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Code:
    hserin [dec x,WAIT(" "),dec y]
    Maybe???
    Dave
    Always wear safety glasses while programming.

Similar Threads

  1. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 08:26
  2. pic Basic Pro 2.50a & debug statement
    By Phil Moore in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 17th March 2008, 09:41
  3. PIC BASIC or PIC BASIC PRO
    By kirkmans in forum USB
    Replies: 3
    Last Post: - 20th April 2007, 00:52
  4. Replies: 5
    Last Post: - 17th January 2006, 19:26
  5. Help with MPASM and PIC Basic
    By johngb in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 21st February 2003, 13:07

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