Re: Programme not running Kategorie: Programmierung C (von Tobias - 26.09.2017 20:44) | |
Als Antwort auf Programme not running von Bram Vooys - 15.09.2017 13:28
| |
Dear Bram, only generally: Your information is somewhat poor. You should describe something more which does not work if you expect help. It would also be nice if you would give feedback once on messages whether it helped you or not, for example whether the DA converter is working now. I can compile the program anyway. What is not working? Greetings, Tobias > Programme not running what did I do wrong? > > /*------------------------------------------------------ > Program: Dynamic Shock Absorber Test > > Unit: C_Control PRO Mega 32 > IDE: C_Control PRO IDE > > Function: > > Reading from a Rotary Encoder > Trig0 = 360 grd > Trig1 = 360/200 > > input: Trig0,Trig1 > input: AD0,AD1,AD3 > output: DO1,DO2: Relais sturing > output: D/A (later ?) > > Input and Output is done via RS232 interface > > /*---------------------------------------------------*/ > > // Declaratie Poorten Interupt ?? > > // ?? #define EXTINT 26 // Externe ingang pin nr PD2 > // ?? #define INTMODE 3 // Rising Edge > // ?? #define EXTINT 27 // Externe ingang pin nr PD3 > // ?? #define INTMODE 3 // Rising Edge > > #define LF 0x0A > #define CR 0x0D > /*----------------------------------------------------*/ > > void Pulse0(int Trig0) > > { > // Ext_IntDisable(26); ?? > // Set Data Register for Start place (later) > Serial_WriteText(0,"Trig0"); // Test > } > > void Pulse1(int Trig1) > > { > // Ext_IntDisable(27); ?? > // Increment Data Register > // Store data (Register+1)from ADC > Serial_WriteText(0,"Trig1"); // Test > } > > > void main(void) > { > int Trig0; > int Trig1; > int i; > int n; > byte c; // Variables declaration > byte Buf_Index; > word ADC_Value; > char ADC_String[10]; > > Serial_Init(0,SR_8BIT|SR_1STOP|SR_NO_PAR,SR_BD9600); > ADC_Set(ADC_VREF_VCC,0); > > Irq_SetVect(INT_0,Trig0); > Irq_SetVect(INT_1,Trig1); > > Ext_IntEnable(0,1); > Ext_IntEnable(1,1); > > Port_DataDirBit(19,1); // Start Stop Freq Reg. > Port_DataDirBit(20,1); // Res. > > while(1) > { > c=Serial_ReadExt(0); > if(c==65) // A > { > Port_WriteBit(19,PORT_ON); > } > if(c==67) // C > { > Port_WriteBit(19,PORT_OFF); > } > > // Stop Interupt 1 en 2 > // Read Register from 0-200 (later) > > if(c==63) // Only for test > {for (i=0;i<3;i++) > { > ADC_Set(0x40,i); > Str_WriteInt(ADC_Read(),ADC_String,0); // 0 RPM 0-5 Volt > Serial_WriteText(0,ADC_String); // 1 Force 0-5 Volt > Serial_WriteText(0,":"); // 2 Temp > AbsDelay(5); > Serial_Write(0,CR); > } > Buf_Index=0; // Clear buffer > } > // Set Interup on > > } > } > > Please help. > > > Thanks Bram | |
Antwort schreiben Antworten: |
Zur Übersicht - INFO - Neueste 50 Beiträge - Neuer Beitrag - Suchen - Zum C-Control-I-Forum - Zum C-Control-II-Forum