??? 03/10/08 22:17 Read: times |
#152103 - Gentlemen....thats what I thought I had!! Responding to: ???'s previous message |
Code architect generated an interrupt based code and when I applied it, it keeps messing up everything else.
Maybe I'm just missing something, its generating a .c and .h. If someone where to generate the code in code architect, how should the main.c be addressing the adc.c functions by default? What you saw above is how my main.c looked calling the adc.c, it just doesn't seem to work....and I'm not sure what to do. The code below is setting up the port as QUASI BIDIRECTIONAL yet code architect is doing it as OPEN DRAIN i believe. Not sure if that's the issue or not, didn't have time to test it. I found a way to do it in software similiar to the interupt method, but no interrupt. Just before I left, it seemed to be doing the job, but I'm sure its not as robust as it should be. Here is what I was using, it shared similiar coding as the code architect but it was running standalone and without the rest of my code......thoughts on it? void main () { P2M1=0x00; P2M2=0x00; ADINS=0x40; ADMODA=0x10; ADCON1=0x04; ADMODB=0xE0; while(1) { unsigned char size; // ADC conversion variable unsigned char edata1; // EEprom stored zoom optical zoom variable ADCON1 |=0x01; while ((ADCON1 & 0x08) == 0 ) ADCON1 &= 0xF7; size = AD1DAT2; //size = 0x10; eeprom_init(); // initialize internal eeprom data transfer eeprom_read(0x001); // read internal eeprom > address 001 (optical zoom value) edata1 = DEEDAT; // EEprom register data dump to variable exchange //edata1 = 0x10; ......... data functions/actions below using DEEDAT compared against the size variable, not needed for viewing, it just drives a motor left or right....... |
Topic | Author | Date |
Problems with Code Architect and interrupts | 01/01/70 00:00 | |
where is the ISR? | 01/01/70 00:00 | |
Erik... | 01/01/70 00:00 | |
you enable an interrupt for which there is no ISR | 01/01/70 00:00 | |
I missed the ISR routine.... | 01/01/70 00:00 | |
Whoops, here is the .c file with the ADC ISR..... | 01/01/70 00:00 | |
Also forgot mention...simulation works fine | 01/01/70 00:00 | |
I found part of my problem | 01/01/70 00:00 | |
Interrupts | 01/01/70 00:00 | |
Modified.....seems right, I2C bus going nuts | 01/01/70 00:00 | |
Polling or Interrupts | 01/01/70 00:00 | |
Exactly...... | 01/01/70 00:00 | |
Opinion | 01/01/70 00:00 | |
Gentlemen....thats what I thought I had!! | 01/01/70 00:00 | |
Port config![]() | 01/01/70 00:00 | |
poll .... | 01/01/70 00:00 |