/*--------------------------------------------------------------------------*/void RxSerial (void) {/*--------------------------------------------------------------------------*//* ;---------------------------------------------------------------------------* ; Receives 1 start bit Lo, 9 data bits and 1 stop bit Hi at 9600 bps ; Byte time = 1.144 mS ; Bit time = 104 uS (0.16% erro w/10 Mhz) ; ; False start bit check ; ; Start bit hunting timeout = 4*1.283ms ; ; Input : none ; Output : Carry = 1 => success ; rxBuf[0,1] = input byte +9th bit ; Carry = 0 => error (timeout or stop bit=0) ;---------------------------------------------------------------------------**/ char idx; rxBuf[0] = 4; // 5.135 ms timeout idx = 0; while (1) { while (RxD_pin) // input "high" { if ((-- idx)==0) { rxBuf[0]--; if (rxBuf[0]==0) { Carry = 0; return; } } } Delay_uSeg(40); // 1/2 bit delay (40*3+7)*0.4us=50.8us if (RxD_pin) continue; // false start bit detection rxBuf[0] = 0x01; // 9 bits counter and reception buffer rxBuf[1] = 0x00; do { Delay_uSeg(81); // (81*3+7)*0.4us=100us nop(); // 0.4us nop(); // 0.4us Carry = RxD_pin; // 1.2us bit read rxBuf[0] = rr(rxBuf[0]); // 0.4us store and count rxBuf[1] = rr(rxBuf[1]); // 0.4us } // 1.2us while (Carry==0); Delay_uSeg(81); // (81*3+7)*0.4us=100us nop(); // 0.4us Carry = RxD_pin; // stop bit read return; // 100 us availiable }}
How long is a tick in CHDK? (eg from get_tick_count) Should it be consistent across all cameras? (DIGIC II/DIGIC III?)
Started by Barney Fife Creative Uses of CHDK
Started by professional_amateur Creative Uses of CHDK
Started by BenCam Hotwire! Hardware Mods, Accessories and Insights
Started by rhameed Script Writing
Started by GB Hello, I'm a NEWBIE - HELP!! (Newbies assistance, User Guides and thank you notes)