Sign in

username:

password:



Not a member?

Search piclist



Search tips

Subscribe to piclist



piclist by Keywords

12F675 | 16F628 | 16F84 | 16f877 | 16F877A | 16F88 | 18F458 | ADC | AVR | Bootloader | CAN | CCS | CRC | EAGLE | EEPROM | ICD | ICSP | IDE | JDM | LED | Macros | Microchip | MPLAB | PCB-CAD | PIC10F | Pic12f675 | PIC16F84 | PIC16F84A | PIC16F877 | PIC18 | PIC18F452 | PicBasic | PICC | PICSTART | PWM | RS-485 | RS232 | SMT | SPI | UART | USART | USB | Wireless | Wisp628 | Xilinx

Ads

Discussion Groups

Discussion Groups | Piclist | PIC 18F458 Timing

A discussion group for the PICMicro microcontroller. Also called the Microchip PIC, this list is dedicated to the use and abuse of this fine, simple, microcontroller. Close to topic posts are welcome, ie. general electronics.

PIC 18F458 Timing - Author Unknown - Jul 14 19:56:00 2004

I'm using an accelerometer to measure velocity. So it's VERY
important that I know the time between each measurement of the
accelerometer. I have a 4MHz clock and I'm using CCS C compiler and
my code is as follows:

while( input(PIN_C2) ); // wait until low
while( !input(PIN_C2) ); // wait until high
while( input(PIN_C2) ) { // count high-time
high++;
}
while( !input(PIN_C2) ) { // count low-time
low++;
}

value = (float)high/(high + low); // calculate
value
Thanks,
Shamoon




(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )