please dont rip this site

PIC 18F8760 Specific RS232 routine

by Jim at JPes

Starting with an unknown board
https://plus.google.com/u/0/+JamesNewton/posts/CKnu7yU9BGv
found by a local electronics recycler:
http://www.ourplanetrecycling.com/

This board is from a muscle stimulant system for post surgery recovery, manufactured by/for, and distributed by VQ Orthocare. There are newer units to replace it now. This unit is the SurgiStim3, and has been replaced with SurgiStim4. If you power it up with >5V, and ground the third pin from the left of J2, the unit powers up, shows an opening screen from half a second or so, then goes to a screen that says your authorized time of use has elapsed and to put it in the cradle overnight for updates.

It appears that J1 is an ICSP connector. A quick run through with the meter indicates that the pinout of the connector is ...
Pin 1 is VDD (5V),
Pin 2 is Clock,
Pin 3 is Data,
Pin 4 is Reset, and
Pin 5 is Ground.

I have verified that the PIC can indeed be erased and programmed via a PICKit3

{ed: this might be a great board for the Minimal Controller Idea }

 ;================================================
 ;
 ; Simple code example to test port pin and USART
 ; ;================================================
 ; Configuration
 list        p=18F8720
 #include    P18F8720.INC

 CONFIG OSC       = HS
 CONFIG WDT       = OFF
 CONFIG LVP       = OFF
 CONFIG DEBUG     = OFF

 ;================================================
 ; Variables cblock 0x20
 Temp
 endc

                        org 0
 ;================================================
 ; Initialize
 init:
    clrf    PORTB            ; Configure RB7 on PORTB for
    bcf     TRISB, RB7       ;  digital I/O for an LED.

    bcf     TRISC, RC6       ; Set TRISC<6:7> to enable.
              pic Pin 37 (xmt)
    bsf     TRISC, RC7       ;  serial.
              pic Pin 38 (rcv)

    bcf     PORTB, RB7       ; Turn LED off.  pic Pin 47

    movlw   0x67             ;  serial eusart to 9600 (0x19 with BRGH=0)
    movwf   SPBRG1           ;  baud.
(0x67 with BRGH=1)

     movlw   b'00100100'      ; Enable Transmit and clear SYNC
    movwf   TXSTA1           ; to allow asynchronous mode.
       movlw   b'10010000'      ; Enables Serial Port      movwf
RCSTA1                         ; and Continuous Receive
      bcf     RCSTA1, CREN           ; Clear any errors by disbaling
nop                                         ; continuous receive mode,
then     bsf     RCSTA1, CREN         ; renable conitnuous receive mode
        receive        bsf                PORTB, 7
        movf        RCREG1,W
        nop
        nop
        btfss        PIR1,5        ; (5) check for received data RC1IF
        goto        $ - 2
    movf        RCREG1,W          ; save received data in W     bcf
          PORTB, 7
    toggle:                      ; Toggle back and forth
    btg     Temp, 0          ;  between loading 'U'
    btfsc   Temp, 0          ;  and loading 'G' in the
    goto    load_U           ;  W register.
    goto    load_G           ;  ...


 load_U:          bsf                LATB,7                    ;  ...
        movlw        'R'         ;  Put 'R' in W and
        call        tx
        movlw        'B'
        call        tx
        movlw        '7'
        call        tx
        movlw        ' '
        call        tx
        movlw       'O'          ;  Put 'G' in W and
        call        tx
        movlw        'n'
        call        tx

        movlw   0x0A              ;  Put 'CR/LF' in W and transmit.
          call        tx
        movlw        0x0D
        call        tx

        btfss        PIR1,5        ; (5) wait for received data RC1IF
        goto        $ - 2
        movlw        'D'
        subwf        RCREG1,W
        btfsc        STATUS,Z
        goto    toggle
        goto        load_U
        goto    toggle


 load_G:            bcf                LATB,7                 ;  ...
        movlw        'R'              ;  Put 'G' in W and
        call        tx
        movlw        'B'
        call        tx
        movlw        '7'
        call        tx
        movlw        ' '
        call        tx
        movlw        'O'              ;  Put 'G' in W and
        call        tx
        movlw        'f'
        call        tx
        movlw        'f'
        call        tx

        movlw   0x0A              ;  Put 'CR/LF' in W and transmit.
          call        tx
        movlw        0x0D
        call        tx

        btfss        PIR1,5        ; (5) wait for received data RC1IF
        goto        $ - 2
        movlw        'U'
        subwf        RCREG1,W
        btfsc        STATUS,Z
        goto    toggle
        goto        load_G


 tx:
    movwf   TXREG            ; Move W into tx register and provide
    nop                      ;  a cycle for TXIF to update.
 check:
    btfss   PIR1, TXIF       ; Wait for tx by monitoring TXIF
    goto    check            ;  Goto check while not done.
        return
     end

file: /Techref/microchip/18F8720-j.htm, 6KB, , updated: 2016/1/6 20:36, local time: 2024/11/26 07:05,
TOP NEW HELP FIND: 
3.14.249.124:LOG IN

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://sxlist.com/Techref/microchip/18F8720-j.htm"> PIC 18F8760 Specific RS232 routine</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

 

Welcome to sxlist.com!


Site supported by
sales, advertizing,
& kind contributors
just like you!

Please don't rip/copy
(here's why

Copies of the site on CD
are available at minimal cost.
 

Welcome to sxlist.com!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .