ขาย IC MC3PHACVPE MOTOR CONTROL SPEED CONTROL Tel 0838349010 สอบถามได้ครับ
3 phase motor control หรือที่เรื่อง Inverter
3 phase motor control หรือที่เรื่อง Inverter
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts Menu
#include"stm32f10x.h"
void delay(uint32_t num)
{
while(num--);
}
void Clock()
{
RCC->CFGR = 0; // Reset RCC_CFGR Register
RCC->CR = RCC_CR_HSEON; // Set External Xtal ON
while((RCC->CR & RCC_CR_HSIRDY)==0); // Wait Xtal ON
/* Configuration Clock */
RCC->CFGR = RCC_CFGR_PLLSRC|RCC_CFGR_SW_PLL|RCC_CFGR_PPRE1_DIV2|
RCC_CFGR_ADCPRE_DIV6|RCC_CFGR_PLLMULL9;
/* Enable PLLON */
RCC->CR |= RCC_CR_PLLON;
while((RCC->CR & RCC_CR_PLLRDY)==0);
}
void GPIO()
{
RCC->APB2ENR = RCC_APB2ENR_IOPCEN|RCC_APB2ENR_IOPEEN; // เปิดคล็อกให้พ็อท C&E
GPIOC->CRL = 0x33000000; // bit6, bit7
GPIOC->CRH = 0x00000033; // bit8,bit9
GPIOE->CRL = 0x00008888; // bit6, bit7
GPIOC->ODR = 0;
}
int main()
{
Clock();
GPIO();
while(1)
{
if(GPIOE->IDR&0x01==1) // ตรวจสอบ bit 0
GPIOC->ODR |= 0x40;
else
GPIOC->ODR &= FFBF;
if(GPIOE->IDR&0x02==1) // ตรวจสอบ bit 1
GPIOC->ODR |= 0x80;
else
GPIOC->ODR &= FF7F;
if(GPIOE->IDR&0x04==1) // ตรวจสอบ bit 2
GPIOC->ODR |= 0x0100;
else
GPIOC->ODR &= FEFF;
if(GPIOE->IDR&0x08==1) // ตรวจสอบ bit 3
GPIOC->ODR |= 0x0200;
else
GPIOC->ODR &= FDFF;
}
}
#include"stm32f10x.h"
void delay(uint32_t num)
{
while(num--);
}
void Clock()
{
RCC->CFGR = 0; // Reset RCC_CFGR Register
RCC->CR = RCC_CR_HSEON; // Set External Xtal ON
while((RCC->CR & RCC_CR_HSIRDY)==0); // Wait Xtal ON
/* Configuration Clock */
RCC->CFGR = RCC_CFGR_PLLSRC|RCC_CFGR_SW_PLL|RCC_CFGR_PPRE1_DIV2|
RCC_CFGR_ADCPRE_DIV6|RCC_CFGR_PLLMULL15; // [b]เปลี่ยนจาก PLL9 เป็น PLL15[/b] 8*14 = 112 Mhz
/* Enable PLLON */
RCC->CR |= RCC_CR_PLLON;
while((RCC->CR & RCC_CR_PLLRDY)==0);
}
void GPIO()
{
RCC->APB2ENR = RCC_APB2ENR_IOPCEN; // เปิดคล็อกให้พ็อท C
GPIOC->CRL = 0x33000000; // bit6, bit7
GPIOC->CRH = 0x00000033; // bit8,bit9
GPIOC->ODR = 0;
}
int main()
{
Clock();
GPIO();
while(1)
{
GPIOC->ODR ^= 0x03C0; //ไฟกระพริบ ที่ GPIOC Bit 6, Bit7, Bit8, Bit9
delay(5000000); // ฟังก์ชันหน่วงเวลา
}
}
#include"stm32f10x.h"
void delay(uint32_t num)
{
while(num--);
}
void Clock()
{
RCC->CFGR = 0; // Reset RCC_CFGR Register
RCC->CR = RCC_CR_HSEON; // Set External Xtal ON
while((RCC->CR & RCC_CR_HSIRDY)==0); // Wait Xtal ON
/* Configuration Clock */
RCC->CFGR = RCC_CFGR_PLLSRC|RCC_CFGR_SW_PLL|RCC_CFGR_PPRE1_DIV2|
RCC_CFGR_ADCPRE_DIV6|RCC_CFGR_PLLMULL3; // เปลี่ยนค่า PLL 8*3=24Mhz
/* Enable PLLON */
RCC->CR |= RCC_CR_PLLON;
while((RCC->CR & RCC_CR_PLLRDY)==0);
}
void GPIO()
{
RCC->APB2ENR = RCC_APB2ENR_IOPCEN; // เปิดคล็อกให้พ็อท C
GPIOC->CRL = 0x33000000; // bit6, bit7
GPIOC->CRH = 0x00000033; // bit8,bit9
GPIOC->ODR = 0;
}
int main()
{
Clock();
GPIO();
while(1)
{
GPIOC->ODR ^= 0x03C0; //ไฟกระพริบ ที่ GPIOC Bit 6, Bit7, Bit8, Bit9
delay(5000000); // ฟังก์ชันหน่วงเวลา
}
}
#include"stm32f10x.h"
void delay(uint32_t num)
{
while(num--);
}
void Clock()
{
RCC->CFGR = 0; // Reset RCC_CFGR Register
RCC->CR = RCC_CR_HSEON; // Set External Xtal ON
while((RCC->CR & RCC_CR_HSIRDY)==0); // Wait Xtal ON
/* Configuration Clock */
RCC->CFGR = RCC_CFGR_PLLSRC|RCC_CFGR_SW_PLL|RCC_CFGR_PPRE1_DIV2|
RCC_CFGR_ADCPRE_DIV6|RCC_CFGR_PLLMULL9;
/* Enable PLLON */
RCC->CR |= RCC_CR_PLLON;
while((RCC->CR & RCC_CR_PLLRDY)==0);
}
void GPIO()
{
RCC->APB2ENR = RCC_APB2ENR_IOPCEN; // เปิดคล็อกให้พ็อท C
GPIOC->CRL = 0x33000000; // bit6, bit7
GPIOC->CRH = 0x00000033; // bit8,bit9
GPIOC->ODR = 0;
}
int main()
{
Clock();
GPIO();
while(1)
{
GPIOC->ODR ^= 0x03C0; //ไฟกระพริบ ที่ GPIOC Bit 6, Bit7, Bit8, Bit9
delay(5000000); // ฟังก์ชันหน่วงเวลา
}
}
#include"stm32f10x.h"
// Xtal 8Mhz Pll*9 = 8*9 = 72Mhz
void Clock()
{
RCC->CFGR = 0; // Reset RCC_CFGR Register
RCC->CR = RCC_CR_HSEON; // Set External Xtal ON
while((RCC->CR & RCC_CR_HSIRDY)==0); // Wait Xtal ON
/* The Configuration of Clock System */
RCC->CFGR = RCC_CFGR_PLLSRC|RCC_CFGR_SW_PLL|RCC_CFGR_PPRE1_DIV2|
RCC_CFGR_ADCPRE_DIV6|RCC_CFGR_PLLMULL9;
/* Enable PLLON */
RCC->CR |= RCC_CR_PLLON;
while((RCC->CR & RCC_CR_PLLRDY)==0);
}
int main()
{
Clock();
}