UsingI2CBus

所属分类:其他嵌入式/单片机内容
开发工具:C/C++
文件大小:98KB
下载次数:100
上传日期:2006-04-17 19:42:13
上 传 者lizhbo
说明:  在Freescale HCS12中使用I2C总线源码
(the use of I2C bus FOSS)

文件列表:
UsingI2CBus\defs\s12_atd.h (14201, 2002-08-22)
UsingI2CBus\defs\s12_bdlc.h (8922, 2002-03-15)
UsingI2CBus\defs\s12_byteflight.h (12315, 2002-08-22)
UsingI2CBus\defs\s12_common.h (8601, 2003-01-20)
UsingI2CBus\defs\s12_crg.h (10405, 2002-03-15)
UsingI2CBus\defs\s12_eeprom.h (7805, 2002-03-15)
UsingI2CBus\defs\s12_fectl.h (5249, 2002-08-05)
UsingI2CBus\defs\s12_flash.h (8866, 2002-09-25)
UsingI2CBus\defs\s12_iic.h (7846, 2002-03-15)
UsingI2CBus\defs\s12_mscan.h (9100, 2002-08-22)
UsingI2CBus\defs\s12_page.h (6984, 2002-03-15)
UsingI2CBus\defs\s12_pim.h (37051, 2002-09-19)
UsingI2CBus\defs\s12_pwm.h (11220, 2002-09-20)
UsingI2CBus\defs\s12_register.h (29440, 2002-09-27)
UsingI2CBus\defs\s12_sci.h (9192, 2002-03-15)
UsingI2CBus\defs\s12_spi.h (8113, 2002-03-15)
UsingI2CBus\defs\s12_template.h (4988, 2002-03-15)
UsingI2CBus\defs\s12_timer.h (21503, 2002-09-19)
UsingI2CBus\defs (0, 2006-04-17)
UsingI2CBus\master\bin (0, 2003-01-21)
UsingI2CBus\master\cmd (0, 2003-01-13)
UsingI2CBus\master\esl.cfg (55, 2002-05-20)
UsingI2CBus\master\i2clayout.hwl (341, 2002-05-28)
UsingI2CBus\master\master.mcp (101966, 2003-01-21)
UsingI2CBus\master\prms\_MC9S12DP256_FLAT.prm (9074, 2002-05-21)
UsingI2CBus\master\prms (0, 2006-04-17)
UsingI2CBus\master\project.ini (2087, 2003-01-21)
UsingI2CBus\master\sources\basic.c (16278, 2003-01-20)
UsingI2CBus\master\sources\basic.h (4286, 2002-07-30)
UsingI2CBus\master\sources\peripherals.c (5857, 2003-01-20)
UsingI2CBus\master\sources\peripherals.h (5675, 2002-05-20)
UsingI2CBus\master\sources (0, 2006-04-17)
UsingI2CBus\master (0, 2006-04-17)
UsingI2CBus\slave\bin (0, 2003-01-21)
UsingI2CBus\slave\cmd (0, 2002-05-20)
UsingI2CBus\slave\esl.cfg (55, 2002-05-20)
UsingI2CBus\slave\prms\_MC9S12DP256_FLAT.prm (9074, 2002-05-20)
UsingI2CBus\slave\prms (0, 2006-04-17)
UsingI2CBus\slave\project.ini (2095, 2003-01-21)
... ...

Using the s12_ header files =========================== Module declaration ------------------ Variables of a hardware module type can be declared for a specific linker segment: #pragma DATA_SEG S12_TIMER tTIMER Timer; Address allocation is then done in the linker command file. Has the advantage that the source code doesn't have to change if the module mapping is changed. peripherals.h has external declarations for the following modules: Regs Crg Timer Pim Can0 Can1 Can2 Can3 Can4 Atd0 Atd1 Pwm Sci0 Sci1 Spi0 Spi1 Spi2 Flash Eeprom Iic Page Bdlc Examples of accessing registers ------------------------------- Byte register in s12_timer.h Timer.tscr1.byte = 0x12; Bit in a timer register Timer.tscr1.bit.ten = 1; Multiple bits in a timer register Timer.tscr1.byte |= (TEN|TFFCA); Word register in s12_timer.h Timer.tcnt.word = 0x1234; Locating header file details in a Code Warrior project ------------------------------------------------------ A quick way to view a header file definition is: right click on the first part of a variable in your source code (e.g. Regs.) select 'Go to variable definition of Regs' right click on on the type qualifier, tRegister (in this example) select 'Go to class declaration of tREGISTER' and the header file should opens. If you then want to see details of an individual register e.g. misc: right click on tMISC select 'Go to class declaration of tMISC' and you should be at the bottom of it's declaration. s12_timer.h exceptions ---------------------- registers : timer input capture/output compare registers implemented : array tc[8] of words, usage : Timer.tc[n].word registers : timer input capture holding registers implemented : array tch[4] of words usage : Timer.tch[n].word s12_pwm.h exceptions -------------------- registers : pwm channel counters implemented : array pwmcnt[8] of bytes access : Pwm.pwmcnt[n].byte registers : pwm channel period counters implemented : array pwmper[8] of bytes access : Pwm.pwmper[n].byte registers : pwm channel duty counters implemented : array pwmdty[8] of bytes access : Pwm.pwmdty[n].byte s12_mscan.h exceptions ---------------------- Complex unions for msCAN ID filter & buffers. registers : identifier acceptance/mask registers implemented : array canid[2] of tCID (ID STRUCTURE) access : Can0.canid[0].canidar.l, Can0.canid[0].canidmr.w[1] registers : foreground receive buffer implemented : BUFFER STRUCTURE - access : Can0.rxbuf.dsr[0], Can0.rxbuf.tsr, Can0.rxbuf.id.w[0] registers : foreground transmit buffer implemented : BUFFER STRUCTURE access : Can0.txbuf.dsr[0], Can0.txbuf.dlr, Can0.txbuf.id.w[0] s12_atd.h exceptions -------------------- registers : atd result registers implemented : array atddr[8] of tADDR access : atd0.atddr[0].word, atd0.atddr[0].datah, atd0.atddr[0].datal s12_byteflight.h exceptions --------------------------- registers : Transmit data registers implemented : array bftdata[12] of tREG08 access : ByteFlight.bftdata[0].byte registers : Receive data registers implemented : array bfrdata[12] of tREG08 access : ByteFlight.bfrdata[0].byte registers : Receive Fifo data registers implemented : array bffdata[12] of tREG08 access : ByteFlight.bffdata[0].byte registers : Message Buffer Control Registers implemented : array bfbufctl[16] of tBFBUFCTL access : ByteFlight.bfbufctl[0].byte, ByteFlight.bfbufctl[0].bit.cfg Alternatives ways to declare peripheral stuctures ------------------------------------------------- 1) use the non-ANSI @ instruction: tTIMER Timer @ 0x0040; - Non-ANSI 2) cast the address as a pointer constant to the module: #define Timer *(tTIMER *)0x0040 - Less effective debugging support

近期下载者

相关文件


收藏者