source= http://www.piclist.com/piclist/2003/08/18/221918a.txt? >PICers - any advice on this one would be most appreciated. 'Tis my 1st foray >into RS232 - i have this old KODAK DC50 dig cam that takes 9600 bd, 8E1. I'm >doing this one coz Oliver Hartmann has/had(?) a handy page about it so i >figured it'd be easy ..... yeah, right :( > >OK, I got the cam sorta detecting the fact it's being spoken to but NO WAY can >I get the damn thing to take a picture. I reckon the prob might in the TX >routine as I'm not real clear about whether u should treat stop bits as active >low in RS232 or not. Parity i understand (I think) so that part should be OK? > >I'm generating RS232 sigs from a PIC using a MAX232. > >If anyone could offer advice/spot anything that don't look right ... heh, well >thankz! i'm totally stumped right now :( > >Debbie :) > > Snip I have not looked at the rest of the code but what you have below is wrong. Your BITWAIT MACRO delay period is 3uS ( @ 4MHz ) per count (except for the last count which is 2uS) So, doing the math 0x32 = 50 DEC 50 * 0.000003 = .00015 = 150uS (not 104uS) You actually need to use 35 DEC (0x23) for your Bit delay 34 * 3 = 102 plus 2 for the last cycle = 104uS You can subtract a little for overhead but it really is not going to matter for a 9600 Baud link. BTW. Bob suggested it might be LANC. (I also suggested as much a month or so ago.) LANC is easy to spot as it is a 8-byte packet protocol. If your camera is LANC (A.K.A. Control -L) then a MAX232 chip is no good as the RS232 needs a Open collector output. If you thing it is LANC, I can email all the data I have. Let me know. Regards, Jim Robertson NEWFOUND ELECTRONICS >;*************************************************************************** >;BITWAIT .. used in serial tx routines with the DC50. Waits for >; 1 bit period. For 9600 baud, BITWAIT should be 104.2 usec >;For a 4MHz Xtal, BITWAIT count = $32 gives 104 uS in a single loop counter? >;*************************************************************************** >BITWAIT MACRO ;Wait for the duration of one Bit > IFDEF DEBUG > nop ;Inactive in DEBUG mode > ELSE > movlw 0x032 ;Calculate C1= 0x033 for 4.0MHz Xtal. > movwf count_02 > decfsz count_02,1 > goto $-1 > ENDIF > ENDM > --- http://www.piclist.com/member/newfound-pipeline- PIC/PICList FAQ: http://www.piclist.com -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu