Searching \ for '[PIC]: DC50 SMILES!! :) ... was Re: [PIC]:RS232' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/ios.htm?key=rs232
Search entire site for: 'DC50 SMILES!! :) ... was Re: [PIC]:RS232'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: DC50 SMILES!! :) ... was Re: [PIC]:RS232 '
2003\08\21@022148 by ?q?Debbie=20Hynes?=

flavicon
face
PICers - it wuz the Parity bit, the timing AND the 1's/0's in the RS232
data stream were all messed up to start with. Plus i think u can say it
definitely is RS232 and not LANC protocol

BUT .... it works. The 16F84 makes my old DC50 snap a picture upon an
interrupt.

Thankz everybody! This project would have been 100%  NOT DO-ABLE without
the PICLIST  :)

Debbie :)

The essential parts of the code now look like so ===>

#DEFINE  TXD  PORTB,2    ;PORTB.2   (OUTPT)
#DEFINE  RXD  PORTB,1    ;PORTB.1   (INPUT) *Can't use RD! RD=EECON bit in
16F84.inc

tx_cam
                               ;CALCULATE THE PARITY
       movf    txbuf,w         ;Won't always pass direct from w so reload from
txbuf
       movwf   temp            ;Make a copy of the byte
       clrf    parity          ;Set parity to zero if it ain't already
       movlw   d'8'            ;Get set to check 8 bits & calculate parity
       movwf   BitCount
                               ;Now count 1's in temp/txbuf and stash in
parity reg.
calc_parity
       rrf     temp,f          ;Rotate RHS thru C
       btfsc   STATUS,C        ;Is carry bit = 1?
        incf   parity,f        ;Yes - count it.
       decfsz  BitCount        ;No  - keep countin'
        goto    calc_parity    ;...   till u hit zero

       movlw   0x08
       movwf   BitCount
                              ;START BIT
       bcf     TXD            ;RS232 LINE LOW => ACTIVE STATE
       BITWAIT                ;Wait one bit period to alert the camera

                              ;DATA SECTION ... 8 bits TXed with BITWAIT=104
uS
tx_loop rrf     txbuf,f        ;Rotate RHS txbuf thru C
       btfss   STATUS,C       ;C=1
        goto   lowbit         ;Send '0'
hi_bit  bsf     TXD            ;Output LOW, inverting
       BITWAIT
       decfsz  BitCount,f
        goto   tx_loop
       rrf     txbuf,f        ;Leave the HI & LO bytes unchanged in txbuf
                              ;bcf     parity,0     ;TEST ****   .... remove?

                              ;PARITY BIT.
       goto    stopbit        ;KODAK DC50 has no parity! So skip the next.
Leave it in for future use ...

       btfsc   parity,0       ;Test LSB of parity.
        goto   parity_hi      ;If Parity LSB=1, send HI bit => ODD parity
       bsf     TXD            ;Otherwise send a LOW bit. LSB=0, thus EVEN
parity.
       goto   parity_fin      ;Finish with the parity bit
parity_hi
       bcf     TXD            ;Send parity HIGH=1 (RS232 inverted)
parity_fin
       BITWAIT                ;Wait 104 uS

                              ;STOP BIT (followed by idle)
stopbit
       bsf     TXD            ;STOP = o/p LOW (= MARK in RS232??) OR does
STOP= HIGH???
       BITWAIT                ;Wait 104 uS

                              ;IDLE STATE
       bsf TXD                ;RS232 LINE HIGH => IDLE STATE
       retlw   0x00           ;Tx finished so return ....
lowbit
       bcf     TXD            ;Output HIGH, inverting
       goto    hi_bit+1

;************************************************

;The "Take a Picture" routine loops around to send a block of 8 bytes

take_picture
        movlw     0x08           ;Reload the Byte counter
        movwf     ByteCount
loop_picture
        call      cam_pic
        movwf     txbuf
        call      tx_cam
        BITWAIT
        decfsz    ByteCount
         goto     loop_picture
        nop
        decf      camcount       ;Keep track of how many pictures you took.

;**********************
;
;Cam_Pic grabs an indexed byte of data & returns it in w

;command string: 77 00 00 00 00 00 00 1A (hex)
;Gotta send the command string in reverse order, ie 1A -> 77 ?

cam_pic  movf  ByteCount,0                                         ;Send a
block of 8 bytes to the camera.
        addwf PCL,1                                               ;Need a
"dummy" $FF byte at start or we jump past the end.
        DT  0xFF, 0x1A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77  ;REVERSED
1A, 77 !! 21/08/03

;********************

BITWAIT  MACRO                  ;Wait for the duration of one Bit
        IFDEF DEBUG
          nop                  ;Inactive in DEBUG mode
        ELSE
         movlw    0x21         ;Measured (CRO) 0x021 -> 104uS for 4.0MHz Xtal+
overhead.
         movwf    count_02
         decfsz   count_02,1
          goto    $-1
         ENDIF
        ENDM


http://search.yahoo.com.au - Yahoo! Search
- Looking for more? Try the new Yahoo! Search

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

2003\08\21@180456 by Barry Gershenfeld

face picon face
>PICers - it wuz the Parity bit, the timing AND the 1's/0's in the RS232
>data stream were all messed up to start with. Plus i think u can say it
>definitely is RS232 and not LANC protocol

I was going to say this yesterday, especially with regard to the
suggestion about Hyperterm; it makes sense to try one piece at
a time if you can.  You just demonstrated how hard it is to
make something work when you have several problems going
on at once.

>
>BUT .... it works. The 16F84 makes my old DC50 snap a picture upon an
>interrupt.

Big congrats!!

Barry

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

2003\08\21@225935 by ?q?Debbie=20Hynes?=

flavicon
face
--- Barry Gershenfeld <spam_OUTbarry_gTakeThisOuTspamZMICRO.COM> wrote: >
yesterday, especially with regard to the
> suggestion about Hyperterm; it makes sense to try one piece at
> a time if you can.  You just demonstrated how hard it is to
> make something work when you have several problems going
> on at once.

U R Telling me!!  :((
>
>
> Big congrats!!
>
Thankz! thought i had spoke 2 soon coz it was flashing & making noises but the
picture count on the camera stayed the same. aha - the pics were going into the
on-cam memory & not the card. must be a command to alter that somewhere.
Best - Debbie :)

http://search.yahoo.com.au - Yahoo! Search
- Looking for more? Try the new Yahoo! Search

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

More... (looser matching)
- Last day of these posts
- In 2003 , 2004 only
- Today
- New search...