kar2on
Member level 1
mikroc timer
I'm trying to write data to an MMC based on values obtained by the ADC. The ADC should sample data and save the value at a frequency of 200HZ, based on a 10MHz crystal running on HS mode. I've pretty much figured out the MMC write and read using the mikroC on a PIC 18f452. The problem is, how do I write an interrupt subroutine for it .
I need the ADC to sample at 200HZ, and then when it has sampled 512 times (only planning to use 8-bits per sample) write that data to the MMC card. How do I write the interrupt for for the ADC to sample at 200Hz, using mikroC? I want to have the interrupt sample the ADC input, save it to an array, then increment a counter. Once the counter reaches 512, reset the counter. In the main function a infinite loop using while(1), will have if statement to test the counter. If the counter is 0 then it will write that the sampled ADC data that was saved into an array to the MMC card.
I just want to know how to write the interrupt, any help will be much appreciated. I don't even know if this is possible, I only took one microcontroller class about 2 years ago, can't really remember it. Plus i did the class using 8051 architecture, now i'm using a PIC. Thanx in advanced.
I'm trying to write data to an MMC based on values obtained by the ADC. The ADC should sample data and save the value at a frequency of 200HZ, based on a 10MHz crystal running on HS mode. I've pretty much figured out the MMC write and read using the mikroC on a PIC 18f452. The problem is, how do I write an interrupt subroutine for it .
I need the ADC to sample at 200HZ, and then when it has sampled 512 times (only planning to use 8-bits per sample) write that data to the MMC card. How do I write the interrupt for for the ADC to sample at 200Hz, using mikroC? I want to have the interrupt sample the ADC input, save it to an array, then increment a counter. Once the counter reaches 512, reset the counter. In the main function a infinite loop using while(1), will have if statement to test the counter. If the counter is 0 then it will write that the sampled ADC data that was saved into an array to the MMC card.
I just want to know how to write the interrupt, any help will be much appreciated. I don't even know if this is possible, I only took one microcontroller class about 2 years ago, can't really remember it. Plus i did the class using 8051 architecture, now i'm using a PIC. Thanx in advanced.