main.c aktualisiert

This commit is contained in:
Fabian Schieder 2026-01-30 18:37:55 +00:00
parent 05b40fb06d
commit 5108e51456

96
main.c
View File

@ -24,6 +24,15 @@ NexEventObj fehlerInd;
#define GROB *((volatile unsigned long *)(BITBAND_PERI(GPIOB_ODR,7))) // V6
#define PUMPE *((volatile unsigned long *)(BITBAND_PERI(GPIOB_ODR,6))) // V7
#define Switch0 *((volatile unsigned long *)(BITBAND_PERI(GPIOB_IDR,12))) // DIL5
#define Switch1 *((volatile unsigned long *)(BITBAND_PERI(GPIOB_IDR,15))) // DIL4
#define Switch2 *((volatile unsigned long *)(BITBAND_PERI(GPIOB_IDR,14))) // DIL6
#define Switch3 *((volatile unsigned long *)(BITBAND_PERI(GPIOB_IDR,13))) // DIL7
#define Switch4 *((volatile unsigned long *)(BITBAND_PERI(GPIOC_IDR,10))) // DIL1
#define Switch5 *((volatile unsigned long *)(BITBAND_PERI(GPIOC_IDR,6))) // DIL0
#define Switch6 *((volatile unsigned long *)(BITBAND_PERI(GPIOA_IDR,11))) // DIL2
#define Switch7 *((volatile unsigned long *)(BITBAND_PERI(GPIOA_IDR,12))) // DIL3
//----------------------------------------------------------
char buffer[24];
@ -48,6 +57,28 @@ void PortConfig(void)
GPIOA -> CRL &= 0x00000000;
GPIOA -> CRL = 0x22222222;
//----- Inputs ------
GPIOA -> CRH &= 0x00000000;
GPIOA -> CRH |= 0x00088000;
GPIOB -> CRH &= 0x00000000;
GPIOB -> CRH |= 0x88880000;
GPIOC -> CRL &= 0x00000000;
GPIOC -> CRL |= 0x28222222;
GPIOC -> CRH &= 0x00000000;
GPIOC -> CRH |= 0x22222822;
GPIOA -> ODR &= 0x0000;
GPIOB -> ODR &= 0x0000;
GPIOC -> ODR &= 0x0000;
GPIOA -> ODR |= 0x1800;
GPIOB -> ODR |= 0xF000;
GPIOC -> ODR |= 0x0440;
}
void uart2_init(void)
@ -244,6 +275,14 @@ int main(void)
Nex_Init(0);
Init_Nex_UI();
fuellstand(0);
fehler(0);
leerBlasen(0);
fein(0);
grob(0);
pumpe(0);
wait_sys_ms(20);
uart2_putString("Dosieranlage V01\r\n");
while(1)
@ -251,22 +290,55 @@ int main(void)
Nex_Event_Loop(nextlisten_list);
wait_sys_ms(20);
fuellstand(67);
fehler(1);
leerBlasen(1);
fein(1);
grob(1);
pumpe(1);
wait_sys_ms(3000);
fuellstand(10);
if(Switch0 == 1)
{
uart2_putString("Switch0\r\n ");
wait_sys_ms(20);
}
else if(Switch1 == 1)
{
uart2_putString("Switch1\r\n ");
wait_sys_ms(20);
}
else if(Switch2 == 1)
{
uart2_putString("Switch2\r\n ");
wait_sys_ms(20);
}
else if(Switch3 == 1)
{
uart2_putString("Switch3\r\n ");
wait_sys_ms(20);
}
else if(Switch4 == 1)
{
uart2_putString("Switch4\r\n ");
wait_sys_ms(20);
}
else if(Switch5 == 1)
{
uart2_putString("Switch5\r\n ");
wait_sys_ms(20);
}
else if(Switch6 == 1)
{
uart2_putString("Switch6\r\n ");
wait_sys_ms(20);
}
else if(Switch7 == 1)
{
uart2_putString("Switch7\r\n ");
wait_sys_ms(20);
}
else
{
fuellstand(0);
fehler(0);
leerBlasen(0);
fein(0);
grob(0);
pumpe(0);
wait_sys_ms(3000);
wait_sys_ms(20);
}
}
}