HSERIN & Interupts (aka controlling PIC programs from a remote PC)


Results 1 to 17 of 17

Threaded View

  1. #5
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default

    Thanks for taking the time to respond.

    Ok, I made that change to the header config. (I already had the correct PIC variant selected)

    The include DT bits where in my original program (I cut/pasted a last minute 'just before bed' effort into my post above, where I'd obviously not put that bit in). Actually, now that I have put them back in, I'm getting even more compilation errors - see this screen scrape...

    (it's a little blurry - but the image can be enlarged a bit more by clicking on the image after opening it the first time)

    here's the code (by the way, which option is everyone choosing when they paste iup their code to have it in a box?!)...

    @MyConfig1 = _XT_OSC & _WDT_ON & _MCLRE_ON & _CP_OFF
    @MyConfig2 = MyConfig & _MCLRE_ON & _BOR_OFF
    @ __config MyConfig1 & MyConfig2

    INCLUDE "DT_INTS-14.bas" ; Base Interrupt System
    INCLUDE "ReEnterPBP.bas" ; Include if using PBP interrupts

    DEFINE OSC 4
    DEFINE HSER_SPBRG 25
    DEFINE HSER_TXSTA 24h
    DEFINE HSER_CLROERR 1
    ANSELH=0
    ANSEL=0
    CM1CON0 =0
    CM2CON0 =0
    CM2CON1 =0
    adcon1=0
    TRISB.6 = 1
    TRISB.7 = 0
    TRISC=%00000000 ; set all Port C pins as outputs
    rcsta.7=1 'SPEN serial port enable bit
    low portc.0
    low portc.1
    low portc.2
    low portc.3

    mybyte var byte

    '::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::::::::::::::
    ASM
    INT_LIST macro ; IntSource, Label, Type, ResetFlag?
    INT_Handler RX_INT, _Get_char, PBP, yes
    endm
    INT_CREATE ; Creates the interrupt processor
    ENDASM

    '::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::::::::::::::

    @INT_ENABLE RX_INT

    loop:
    if mybyte="1" then
    hserout ["got it!"]
    mybyte=0
    endif
    if mybyte<>"1" then
    hserout ["didn't get it!"]
    mybyte=0
    endif
    goto loop


    '---[USART RX Interrupt handler]----------------------------------------------------
    Get_char:
    hserin 100,noreceived,[mybyte] 'Get byte
    noreceived: 'or if timeout return
    @INT_RETURN
    Last edited by HankMcSpank; - 17th June 2009 at 10:45.

Similar Threads

  1. Replies: 24
    Last Post: - 2nd October 2017, 11:35
  2. Direct PIC to PC without MAX232
    By acjacques in forum Serial
    Replies: 14
    Last Post: - 23rd October 2014, 21:32
  3. Send data PIC to PC
    By konter in forum Off Topic
    Replies: 6
    Last Post: - 25th December 2009, 22:04
  4. Replies: 67
    Last Post: - 8th December 2009, 02:27
  5. Controlling power to a PIC with another PIC
    By jswayze in forum Off Topic
    Replies: 3
    Last Post: - 28th May 2005, 19: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