• slider image 442
  • slider image 483
  • slider image 484
  • slider image 485
  • slider image 486
  • slider image 487
  • slider image 488
  • slider image 491
:::


Browsing this Thread:   1 Anonymous Users






Re: 控制四個七段顯示器
#2
初級會員
初級會員


查看用戶資訊
不知能不能用這支程式修改
#include "p30F4011.h"
#define FCY 10000000

#define B1 LATDbits.LATD0
#define B2 LATDbits.LATD1
#define DIR_B1 TRISDbits.TRISD0
#define DIR_B2 TRISDbits.TRISD1
#define B3 LATDbits.LATD2
#define B4 LATDbits.LATD3
#define DIR_B3 TRISDbits.TRISD2
#define DIR_B4 TRISDbits.TRISD3

int i;
int j;

#define input 1
#define output 0

unsigned char LEDInde = 0;

void delay_ms(int A );
//---------------------------------------------------------------------------
// Set LEDTable Value 共陰極LED

const unsigned int LEDTable[] ={0x003F,0x0006,0x005B,0x004F,0x0066,0X006D,0x007D,0x0007,0x007F,0x0067,0x0077,0x007C,0x0039,0x005E,0x0079,0x0071};
//---------------------------------------------------------------------------
// main subroutine. Initializes all modules used and turns on and off timer 1
int main(void)
{
ADPCFG=0xFFFF; // ADPCFG = 1111 1111 1111 1111

PORTB=0xffff;
TRISB=0xffff;
LATB=0xffff;
// 所有 AD Input 都規劃為 Digital I/O
PORTD=0xffff;
TRISD=0xffff;
LATD=0xffff;



DIR_B1 = 0 ; // Define LED7 & 8 as Digital Outputs (Led Active Low)
DIR_B2 = 0 ;
DIR_B3 = 0 ; // Define LED7 & 8 as Digital Outputs (Led Active Low)
DIR_B4 = 0 ;

TRISBbits.TRISB0 = 0; // Define RE0 = 0 ,輸出
TRISBbits.TRISB1 = 0; // Define RE1 = 0 ,輸出
TRISBbits.TRISB2 = 0; // Define RE2 = 0 ,輸出
TRISBbits.TRISB3 = 0; // Define RE3 = 0 ,輸出
TRISBbits.TRISB4 = 0; // Define RE4 = 0 ,輸出
TRISBbits.TRISB5 = 0; // Define RE5 = 0 ,輸出
TRISBbits.TRISB6 = 0; // Define RE6 = 0 ,輸出
TRISBbits.TRISB7 = 0; // Define RE7 = 0 ,輸出

TRISEbits.TRISE0 = 0; // Define RE0 = 0 ,輸出
TRISEbits.TRISE1 = 0; // Define RE1 = 0 ,輸出
TRISEbits.TRISE2 = 0; // Define RE2 = 0 ,輸出
TRISEbits.TRISE3 = 0; // Define RE3 = 0 ,輸出
TRISEbits.TRISE4 = 0; // Define RE4 = 0 ,輸出
TRISEbits.TRISE5 = 0; // Define RE5 = 0 ,輸出


while(1)

for(i=0;i<11;i++)
{
LATB=(int)LEDTable[LEDInde+i];
delay_ms(30000);

}
}




void delay_ms(int A)
{
for(j=0;j<A;j++);
//return;

}

發表於: 2008/1/30 22:34
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


控制四個七段顯示器
#1
初級會員
初級會員


查看用戶資訊
請問客位大大
我想做四位元的七段顯示器控制
從0~9999
要如何控制
我用dsp30f4011
不知如何下手

發表於: 2008/1/30 22:29
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部







You can view topic.
不可以 發起新主題
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You cannot post without approval.
You cannot use topic type.
You cannot use HTML syntax.
You cannot use signature.
You cannot create PDF files.
You cannot get print page.

[進階搜尋]


:::

Microchip連結

https://www.facebook.com/microchiptechnologytaiwan/
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
https://page.microchip.com/APAC-PrefCenters-TW.html
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... ]

教育訓練中心

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