:::

論壇索引


Board index » All Posts (lancer0498)




Re: 關於驅動DC馬達
資深會員
資深會員


電源供應器可驅動,正反轉須頻繁(產品壽命測試),
且需做減速動作!

感謝各位高手提供意見!

發表於: 2009/6/5 18:02
頂部


關於驅動DC馬達
資深會員
資深會員


請教各位高手,我用H-bridge來驅動dc motor正反轉,
因負載很重,所以選用的電晶體或mosfet都推不起來,
只有空載時可以,不知到如何才能選用適合的元件?
dc motor:24V-->精由變速齒輪箱變速-->5RPM,
若直接由電源供應器供電推動含負載之24V DC MOTOR的電流為2.5A,請各位高手指點一下

發表於: 2009/6/5 9:41
頂部


Re: 關於GPS TO USART RECEIVE
資深會員
資深會員


嗯,我了解您的意思,但是為何我送出一連串的字,照理來說,
應該就可以跑好幾次中斷了,為何還是只能收第一個字而已,
真苦惱!!

發表於: 2009/5/28 11:48
頂部


Re: 關於GPS TO USART RECEIVE
資深會員
資深會員


我大概了解您的意思,
只是我目前用1byte的方式來收,但只能收一次,
一直找不到哪邊有問題,為什麼收了一次之後就不能再收了!
不好意思,因為是新手,問的問題會很白癡,但很感謝您的回答!
謝謝!

發表於: 2009/5/27 22:37
頂部


Re: 關於GPS TO USART RECEIVE
資深會員
資深會員


謝謝您~
還有請教您如果我在電腦上傳送一連串的字串,
如"123"的話要怎麼收進來?

發表於: 2009/5/27 22:15
頂部


Re: 我用UART收GPS資料會停住,一個個敲字不會 ??
資深會員
資深會員


我用的是pic18f4520 c18來寫

發表於: 2009/5/27 21:57
頂部


Re: 關於GPS TO USART RECEIVE
資深會員
資深會員


程式如下,請各位高手指點
//***********************************************
//Module Name : GPS Receiver *
//DATE : 2009.05.21 *
//WRITER : Edison Yu *
//Last modify : 2009.05.21 PM 23:00 *
//***********************************************
//***********************************************
/* Include Header files */
//***********************************************
#include <p18f4520.h>
#include <usart.h>
#include <stdlib.h>
#include <ctype.h>
#include <timers.h>
#include <delays.h>
#include "evm_lcd.h"

#pragma config OSC=HS,BOREN=OFF,BORV=2,PWRT=ON,WDT=OFF,LVP=OFF

void InitializePORT(void);
void InitializeUSART(void);
void InitializeINTS(void);
void high_interrupt(void);
void RX_isr(void);
void LcdDisplay(const rom char *data);
void RXDisplay(const rom char *data);

// 狀態旗標變數
struct Flag{
unsigned RxD :1; // USART Rx Flag
} FLAGbits;

/* define the LCD_MSG1[] in program memory at 0x1000 */
//*****************************************************
#pragma romdata My_romdata=0x1000
const rom char Lcd_Msg1[]="HOLUX GPS RECEIVER";
#pragma romdata

/* define following variable in data memory at Access Bank */
//***********************************************************
#pragma udata access My_RAM_2
#define BuffLen 16 // 定義緩衝區長度
unsigned char RxBuff[BuffLen];
unsigned char LineCount = 0;

char Hex_ASCII_Code(char DATA);

void main(void)
{
unsigned char cnt;
InitializePORT();
InitializeINTS();
InitializeUSART();
OpenLCD();
LcdDisplay(Lcd_Msg1);
Delay10KTCYx(1000); // 時間延遲
WriteCmdLCD(0x01);
while(1)
{
if(FLAGbits.RxD==1)
{
for(cnt=0;cnt<32;cnt++)
{
RXDisplay( RxBuff[cnt]);
Delay10KTCYx(1000);
}
}
}
}
//************************************************
//* #pragma Interrupt Declarations *
//************************************************
//************************************************
//* Function: isr_high_direct *
//* - Direct execution to the actual *
//* high-priority interrupt code. *
//************************************************
#pragma code high_vector =0x08
void high_interrupt(void)
{
_asm //begin in-line assembly
goto RX_isr //go to isr_high function
_endasm //end in-line assembly
}
#pragma code

//************************************************
//* Function: isr_high(void) *
//* High priority interrupt will *
//* - Received a serial data from RS-232 *
//* Save the received data to buffer Rec_Data*
//************************************************
#pragma interrupthigh RX_isr
void RX_isr(void)
{
unsigned char cnt;
PIR1bits.RCIF=0; // 清除中斷旗標
for(cnt=0;cnt<BuffLen;cnt++)
{
RxBuff[cnt]=ReadUSART(); // Get RS-232 data
}
FLAGbits.RxD=1; // 設定旗標
}
//************************************************
//* Function: InitializePORT *
//* - Make PORTD all outputs *
//* - Turn 0ff all the LED's *
//************************************************
void InitializePORT(void)
{
TRISD=0X00;
PORTD=0X00;
}

//************************************************
//* Function: Initialize USART *
//* - Initialize the RS-232 communication *
//* - Disable Interrupr for TxD *
//* - Enable Interrupt fro Rxd *
//* - Format: 4800, N, 8, 1 *
//************************************************
void InitializeUSART(void)
{
int j;
OpenUSART( USART_TX_INT_OFF // Set TXSTA Reg. =0b00100100
& USART_RX_INT_ON // Set RCSTA Reg. =0b10010000
& USART_ASYNCH_MODE
& USART_EIGHT_BIT
& USART_CONT_RX
& USART_BRGH_HIGH // Set SPBRG=31, Baud Rate = 4800
,64);
RCSTAbits.SPEN=1;
TRISCbits.TRISC7=1; // Set input for RXD
TRISCbits.TRISC6=0; // Set output for TXD
PIE1bits.TXIE=0;
PIR1bits.RCIF=0; // 清除中斷旗標
IPR1bits.RCIP=1; // Set Receive of USART are High priority
PIE1bits.RCIE=1; // Enable RxD Interrupt
FLAGbits.RxD=0;
for(j=0;j<BuffLen;j++) RxBuff[j]=0; //清空 RevBuf
}

//************************************************
//* Function: Initialize Interrupts *
//* - Reset All Interrupr *
//* - Enable HIgh Priority Interrupt *
//* - Disable Low Priority Interrupt *
//************************************************
void InitializeINTS(void)
{
PIR1=0;
PIR2=0;
INTCON=0;
INTCON2=0;
INTCON3=0;
PIE1=0;
PIE2=0;

RCONbits.IPEN=1; // Enable priority interrupts

INTCONbits.GIEL=0; // Disable Low priority Interrupt
INTCONbits.GIEH=1; // Enable high priority Interrupt
}


//************************************************
//* Function: HEX to DEC's ASCII_Code *
//************************************************
char Hex_ASCII_Code(char Data)
{
if(Data<0x0a)
return(Data+0x30);
else
return(Data+0x37);
}

//************************************************
//* LcdDisplay *
//************************************************
void LcdDisplay(const rom char *data)
{
WriteCmdLCD( 0x01 ); // 清除LCD顯示資料
LCD_Set_Cursor( 0, 0 ); // 顯示位置回至第0行第0格
Delay10KTCYx(10); // 時間延遲
putrsLCD(data); // 顯示資料
Delay10KTCYx(10); // 時間延遲
}

void RXDisplay(const rom char *data)
{
WriteCmdLCD( 0x01 ); // 清除LCD顯示資料
LCD_Set_Cursor( 0, 0 ); // 顯示位置回至第0行第0格
Delay10KTCYx(10); // 時間延遲
putcLCD(data); // 顯示資料
Delay10KTCYx(10); // 時間延遲
}

發表於: 2009/5/27 21:20
不怕苦...苦半輩子;怕苦...苦一輩子
頂部


Re: 關於GPS TO USART RECEIVE
資深會員
資深會員


這些範例我有參考,但問題來了,因為我送的是不固定的字串,
我目前無法顯示一連串的字,只能顯示第一個字,而且收了一次後,就無法繼續收了,一直找不到原因為何?

發表於: 2009/5/27 18:23
頂部


Re: 我用UART收GPS資料會停住,一個個敲字不會 ??
資深會員
資深會員


請問版主,你是否有寫好的範例,
我也再寫這部分,讀取的時候遇到一些問題,
你是否可以協助一下,謝謝~

發表於: 2009/5/26 23:07
不怕苦...苦半輩子;怕苦...苦一輩子
頂部


關於GPS TO USART RECEIVE
資深會員
資深會員


請問各位高手,是否有GPS用USART讀進PIC18,
然後顯示資料於LCM上的C語言範例,因自己在學,
有些問題,不知誰能幫我,謝謝!感激不盡

發表於: 2009/5/26 16:43
頂部



« 1 ... 17 18 19 (20) 21 »



:::

Microchip連結

https://www.linkedin.com/company/microchiptechnologytaiwan
https://www.facebook.com/microchiptechnologytaiwan/?locale=zh_TW
https://mkpage.microchip.com/l/1082123/2025-03-12/2stnv5
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=13
https://mu.microchip.com/page/tmu
http://elearning.microchip.com.tw/modules/tad_link/index.php?cate_sn=1
http://www.microchip.com/
http://www.microchip.com/treelink
http://www.microchipdirect.com/
http://www.microchip.com.cn/newcommunity/index.php?m=Video&a=index&id=103
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=2
http://www.microchip.com.tw/Data_CD/eLearning/index.html
http://www.microchip.com.tw/RTC/RTC_DVD/
https://www.microchip.com/development-tools/
https://www.youtube.com/user/MicrochipTechnology
[ more... ]

教育訓練中心

!開發工具購買
辦法說明 [業界客戶] [教育單位]
----------------------------------
!校園樣品申請
辦法說明 [教師資格] [學生資格]
----------------------------------