main.c aktualisiert
This commit is contained in:
parent
05b40fb06d
commit
5108e51456
106
main.c
106
main.c
@ -23,6 +23,15 @@ NexEventObj fehlerInd;
|
|||||||
#define FEIN *((volatile unsigned long *)(BITBAND_PERI(GPIOC_ODR,13))) // V5
|
#define FEIN *((volatile unsigned long *)(BITBAND_PERI(GPIOC_ODR,13))) // V5
|
||||||
#define GROB *((volatile unsigned long *)(BITBAND_PERI(GPIOB_ODR,7))) // V6
|
#define GROB *((volatile unsigned long *)(BITBAND_PERI(GPIOB_ODR,7))) // V6
|
||||||
#define PUMPE *((volatile unsigned long *)(BITBAND_PERI(GPIOB_ODR,6))) // V7
|
#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
|
||||||
|
|
||||||
//----------------------------------------------------------
|
//----------------------------------------------------------
|
||||||
|
|
||||||
@ -48,6 +57,28 @@ void PortConfig(void)
|
|||||||
|
|
||||||
GPIOA -> CRL &= 0x00000000;
|
GPIOA -> CRL &= 0x00000000;
|
||||||
GPIOA -> CRL = 0x22222222;
|
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)
|
void uart2_init(void)
|
||||||
@ -243,6 +274,14 @@ int main(void)
|
|||||||
configProgressBar();
|
configProgressBar();
|
||||||
Nex_Init(0);
|
Nex_Init(0);
|
||||||
Init_Nex_UI();
|
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");
|
uart2_putString("Dosieranlage V01\r\n");
|
||||||
|
|
||||||
@ -250,23 +289,56 @@ int main(void)
|
|||||||
{
|
{
|
||||||
Nex_Event_Loop(nextlisten_list);
|
Nex_Event_Loop(nextlisten_list);
|
||||||
wait_sys_ms(20);
|
wait_sys_ms(20);
|
||||||
|
|
||||||
fuellstand(67);
|
|
||||||
fehler(1);
|
|
||||||
leerBlasen(1);
|
|
||||||
fein(1);
|
|
||||||
grob(1);
|
|
||||||
pumpe(1);
|
|
||||||
|
|
||||||
wait_sys_ms(3000);
|
|
||||||
|
|
||||||
fuellstand(10);
|
|
||||||
fehler(0);
|
|
||||||
leerBlasen(0);
|
|
||||||
fein(0);
|
|
||||||
grob(0);
|
|
||||||
pumpe(0);
|
|
||||||
|
|
||||||
wait_sys_ms(3000);
|
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(20);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user