Introduction
This module is for controlling frequency inverter. We all know that for controlling rotation frequency of the motor, all inverters have interface connector for 'Frequency setting potentiometer'. Sadly all the cheap inverters don't have the possibility to set speed of motor to exact value, according to speed potensiometer. This article describes a method of getting around this limitation (using Silabs C8051F300 MCU).
View large module
Background
This is a working- tested module for the plastic machinery, which makes plastic trashbag's which are sold anywhere in construction shops. When I was working as an electrical technician in such an industry, to speed up the production line, I attached this module to the machine.
By attaching this module, I gain update speed even upto 2 times, compared to the previous one.
Using the Code
In the code header, we set 'count
'- count of bags, when reached- starts decelerate to speed, pointed in 'MAX_CAN_READ
'.
To avoid tearing bags apart from each other, module includes protection value 'LEVEL
'.
'MAX_SPEED
' is limited to ADC (Analog Digital Converter) output value, which is dependant on MCU Supply Voltage(VDD). C8051F300 supply voltage ranges from 2.7 to 3.6VDC.
Port I/O (Input-Output) Output High Voltage = VDD – 0.7
To set up 'count
' - while holding down 'RED
' button choose with 'UP
' or 'DOWN
' desired value.
Timer1
is responsible for updating UART
output. Timer0
for reading switch 1, 2 state and updating GREEN LED state. ADC interrupt updates the output voltage and UART
buffer. For power losses, count value is stored in flash address '1A00
'.
The main routine looks like this:
void main (void)
{
PCA0MD &= ~0x40; SYSCLK_Init (); PORT_Init (); Timer_Init();
ADC0_Init(); UART0_Init(); YELLOW_LED_STATE = BLINK_OFF;
count = FLASH_ByteRead(0x1A00);
if (count > 25) count = 25;
PCA_Init();
CR = 1; EIE1 = 0x0C;
EA = 1; while (1)
{
if (RED == 0)
{
if (YELLOW_LED_STATE == SOLID_OFF) count_blinks=0;
if(count_blinks < count)
{
YELLOW_LED_STATE = BLINK_SLOW;
}
else
{
YELLOW_LED_STATE = BLINK_OFF;
}
}else
{
YELLOW_LED_STATE = SOLID_OFF;
if(count_blinks > count) override_flag = TRUE;
else override_flag = FALSE;
}
if (upd_flag == TRUE)
{
erase_flash_page();
FLASH_ByteWrite(0x1A00, count);
upd_flag = FALSE;
}
}
}
Other Articles
Please take a look at my other articles listed below:
There, you can find instructions to update Silabs MCU-s with USB-Toolstick.
History
- 30th March, 2010: Initial post