Home

The Dragon-12 Plus Manual

image

Contents

1. bicz DSP1 orga DSP2 DIE1 DSP O pica DSPA 3 la 3 le e ls i 3 EDH SEU DER KOJ I E o o RNG 158 x 4 E Ej J ae a ES SS S Ee wg30349 85930349 TERPPPPT P PBOx p24 SEGA PRIX P25 I SEGB PRD P26 SEGC PRIX P27 SEGO PB4x P26 BELE PBSK P29 SEGF PRG PIG SEGG PBT P31 DP 8 iv Se l4 a 2 E H The digit 3 2 1 and 0 are driven by PPO PP1 PP2 and PP3 respectively The 7 segment LED is turned on one at a time at 250 Hz refresh rate It s so fast that our eyes will perceive that all 4 digits are turned on at the same time To display the number 1234 on the 7 segment display the following steps should be taken 1 Output 06 to port B set PPO low and PP1 PP2 and PP3 high The number 1 is shown on the digit 3 the leftmost digit but other 3 digits are turned off 2 Delay ims 3 Output 5B to port B set PP1 low and PPO PP2 and PP3 high The number 2 is shown on the digit 2 but other 3 digits are turned off 4 Delay ims 5 Output 4F to port B set PP2 low and PPO PP1 and PP3 high The number 3 is shown on the digit 1 but other 3 digits are turned off 6 Delay ims 7 Output 66 to port B set PP3 low and PPO PP1 and PP2 high The number 4 is
2. Please carefully examine the default jumper settings before turning on the board 1 The J1 should have a jumper for LCD backlight 2 The J24 should have a jumper installed but J18 should not have a jumper if there is no motor connected to the terminal block T4 The jumper on J18 will turn on the H Bridge U12 If you see a jumper on J18 move it to J24 to reduce power consumption 3 The J26 should have a jumper in the top position so the speaker will be driven by PT5 The speaker can be driven by timer PT5 or PWM PP5 or DAC It defaults for PT5 Without a jumper installed on J26 the speaker won t sound The specification of the AC adapter is DC input 110V DC output 9V Current rating 500mA 1000mA Type of plug 2 1mm female barrier plug center positive WARNING If more power is needed in a robot or other applications the user should upgrade the AC adapter Otherwise the board would keep resetting itself when the VCC drops below 4 6V Do not apply a DC voltage higher than 9V to this board 1 2 MC9S12DG256 features and memory map The Dragon12 Plus board comes with the MC9S12DP256CCPV or the MC9S12DG256CVPE installed The MC9S12DG256 is the best replacement for the MC9S12DP256 since the latter has been discontinued by Freescale The only difference between DG256 and DP256 is the number of CAN ports The DG256 has 2 CAN ports but the DP256 has 5 CAN ports Other than the different number of CAN port these two microcontro
3. COl TIE C11 TIE C31 TIE C41 BEE pa En X Bit None E EC E8 FFE8 FFE9 Enhanced Capture Timer channel 3 I Bit FFE6 FFE7 Enhanced Capture Timer channel 4 I Bit SEFE SEFES Enhanced Capture Timer channel S Bit TIE C5 SFFE2 SFFES Enhanced Capture Timer channel Bit TE C6 FFEO FFE1 Enhanced Capture Timer channel 7 L t TIE C71 FFDE FFDF Enhanced Capture Timer overflow L n TSRC2 TOF FFDC FFDD Pulse accumulator A overflow Bit _PACTL PAOV SDC FFDA FFDB Pulse accumulator input edge L t PACTL PAI DA FFD8 FFD9 SPIO Bit SPOCR1 SPIE SPTIE D8 SCOCR2 FFD6 FFD7 SCIO ren TIE TCIE RIE ILIE D6 FFD4 FFD5 SCH LEI TIE ee ILIE D4 ATDO I Bit ATDOCTL2 ASCIE D2 ATD1 L t ATD1CTL2 ASCIE D0 Port J Bit PTJIF PTJIE CE Port H I Bit PTHIF PTHIE SCC Modulus Down Counter underflow L n MCCTL MCZI CA Fig 8 2 MC9S12DG256 Interrupt vector table 1 37 FFC8 FFC9 Pulse Accumulator B Overflow I Bit PBCTL PBOVI C8 FFC6 FFC7 CRG PLL lock L t CRGINT LOCKIE C6 FFC4 FFC5 CRG Self Clock Mode Bit CRGINT SCMIE C4 FFC2 FFC3 BDLC L t DLCBCR1 IE C2 FFCO FFC1 Bit IBCR IBIE SCH FFBE FFBF L t SP1CR1 SPIE SPTIE BE FFBC FFBD I Bit SP2CR1 SPIE SPTIE BC FFBA FFBB EEPROM L I EECT
4. ananas na ananena 24 Keypad e o a a e a ar 26 IR e SE 27 LOGIC PrOD ecienecccsccccctcceisentcececeatcucccearcucoctansersuscsenncuccucercurssearsucodearsdeewentsercuccueateecteaccorsesceead 27 Tammer POU saeco e tano ai and ad aaa ind kaaa na kani and dn daa ta zadani udana 27 Dual Digital to Analog Converter DACS avansno 28 Gebees eege EES A E A EES 28 4 10 4 11 4 12 4 13 4 14 4 15 Chapter 5 Chapter 6 Chapter 7 Chapter 8 8 1 8 2 8 3 8 4 8 5 IR transceiver and 38 KHZ oscillator aaaaa aaa nana nana nana nana nana sana 28 Dual RS232 communication POTTS 00 aaa aaa nasa anna 28 RS485 communication port aaa aaa 29 External SPI interface aaa nana aaa aaa naa ananasa aaa aaa ananasa sna 29 External FC E EE 29 All jumper settings aaa aaa aaa nana aaa aaa 30 EmbeddedGNU sd cscs cicsceeenssesiecentedvencseceneecectacsnstoscentenenesenasisnueddeceeetadeeusacvaeseasanadeeuaes 32 Code Warrior and Serial monitor aaa aaa nana 34 a E EE 35 AED 36 D Bug12 utility routines aaa aaa aaa ananasa nana 36 Interrupt vector tables aaa aaa aaa aaa aaa aaa ananasa nana 37 Useful web UC 40 Troubleshooting notes aaa aaa aaa aaa aaa aaa aa aa aaa anna 40 Revision Hisstto ane tepati Eege 42 Chapter 1 Introduction 1 1 Welcome Thank you very much for purchasing our Dragon12 Plus trainer The Dragon12 Plus trainer is a low cost feature packed training board for the new Freescale HCS12 microco
5. factory and all sample programs on the CD will drive the speaker via PT5 During reset the bootloader or the serial monitor will generate a chirp via the speaker If the jumper is not placed for the PT5 the chirp won t happen IR transceiver and 38 KHz oscillator The U7 CD4093 generates a 38KHz square wave for the IR transmitter One of the CD4093 s gate is used as a 38 KHz oscillator The value of resistor R10 may vary if the CD4093 is manufactured by a different company If the IR transmitter is not used by an application program the 38 KHz square wave also can be available to the user s circuits on the breadboard If the pin 4 of J27 is short to ground the 38 KHz square wave will be present at the pin next to the RESET pin on the header H3 You also can use MM command to force PS3 or PT4 to low to enable the 38 KHz oscillator U7A The IR detector can be used as an object detection sensor When an object is approach the IR detector it can reflect the 38 KHz signal from IR transmitter to the detector Normally the output of the detector is in high state When a 38 KHz IR signal is detected by the IR detector the output of the detector goes low Dual RS232 communication ports Both P1 and P2 DB9 female connectors are configured as DCE devices and they can be directly connected to the PC s COM ports The P1 connector is used by SCIO of the DG256 while the P2 is used by SC1 of the DG256 The D Bug12 monitor or serial monitor work
6. and write operations The jumper on the J5 can be used to select the Read write function of the LCD module It s write only if the jumper is placed in the right position It supports both the read and write functions if the jumper is placed in the left position Logic probe An on board logic probe LED is connected to pin 47 of header H4 and can be used to monitor a high or low status at any point of the circuit as a logic probe Pin 47 of U10 MC9S12DG256 is not connected to header H4 Trimmer pot The VR2 is connected to the ANO7 input of the ADC port via J17 but the trace at J17 can be cut if ANO7 must be used by target circuits 27 48 4 9 4 10 4 11 Dual Digital to Analog Converters DACs The on board 2 ch 10 bit DAC is installed for learning SPI communication It convers a digital binary code to an analog signal so a program can generate different waveforms from the DAC The DAC being used on the board is LTC1661 Its analog output OUTA is provided on the pin between the headers H7 and H8 The other analog output OUTB is provided on the pin between the headers H1 and H2 A good application is to connect a DAC output to an ADC input so a user can send a binary code to the DAC and read the code back from the ADC Speaker The speaker is a 5V audio transducer and it can be driven by PT5 Output Comparator 5 or PP5 PWM 5 or the output B of the DAC LTC1661 The jumper on J26 is preset for the PT5 at
7. board and then plug it into a new target board to program its flash memory with these two files You even don t have to turn off the power while doing this For your convenience we combined both the bootloader and the D Bug12 monitor into a single s2 file named Boot DBug12v32_DR12P_8MHz s29 In case you need to update both of them you can download this combined file The D Bug12 monitor is an application program runs from the bootloader If you program the D Bug12 portion of flash memory with your application program your program will run automatically in EVB mode after power up or reset When running your code instead of the D Bug12 monitor the bus speed is 4MHz one half of the crystal frequency by default The PLL function must be initialized by your code for a higher bus speed because the D Bug12 monitor firmware was not in flash memory anymore For your convenience we include a PLL code template in chapter 7 If you need to auto start your code upon reset the procedure is available in the folder named flash_programming BOOTLOADER mode PAD1 1 PADO 1 This bootloader allows you to erase program flash memory and erase EEPROM It is mainly used to program the D Bug12 monitor into flash memory or download a user s fully debugged code into the D Bug12 portion of flash memory The latter allows the board to be operated in EVB mode and start your code every time the board is turned on or reset When you program your code into the D Bug
8. cycles 1ms delay dey this instruction takes 1 cycle bne delay this instruction takes 3 cycles dec counter bne delay1 not 250ms yet delay again rts end Click File button select Save option to save your assembly source file Save your file frequently while editing If you are creating a new file and giving the file a name to save enter the file name including file extension such as Flash_PB0 asm not just Flash_PBO Click Build button select Assemble option or click the assembler button on the toolbar to assemble your code and generate an s19 file If the assembler detects an error the error message will show the line numbers of your source code that caused the error You have to correct all errors in your program Go to the line and correct the errors and go back to step 3 until there are no errors Press the reset button on the board you will see D Bug12 v4 0 0b32 Copyright 1996 2005 Freescale Semiconductor For Commands type Help gt 21 Type LOAD and then hit lt Enter gt key Click Build button select Download option and locate the file named Flash_PB0 s19 for downloading After download is done type G 2000 and hit lt Enter gt key to run the program For your convenience we have included this sample program on the CD 3 3 Software development 3 3 1 3 3 2 3 3 3 Use on chip 12K RAM for software development in EVB mode You can download your s19 file into the RAM an
9. have a problem running your program Never drag the AsmIDE exe to the desktop folder The default setting of AsmIDE for the Dragon12 Plus board is created in a text file named c Dragon12P AsmIDE ini In the future if you get lost with all the changes you always can copy this file into the folder named c Dragon12P 2 2 Getting Started To operate the Dragon12 Plus board follow steps1 through 5 below 1 Make sure that the both DIP switches of SW7 must be set in the low positions for EVB mode then plug the AC adapter into a wall outlet and plug the DC female plug of the AC adapter into the DC jack on the lower left side of the Dragon12 Plus board After power up the PB7 PBO LEDs should light up from left to right one at a time the speaker should chirp once If the chirp is too soft you can remove the sticker on the speaker to increase the volume and the LCD should display the following message DRAGON12plus EVB you can display your name on LCD and see details D Bug12 EVB MODE at CDROM examples name_display readme txt If it does not occur make sure that the Power On LED indicator is on The PWR LED is on when VCC 5V is present If the PWR LED is off check the output of the AC adapter It 12 should be about 12 5V DC without a load the output DC voltage of the AC adapter is rated for 9V at 500mA but usually the voltage is much higher without a load Plug the male end of the DB9 cable into the DB9 connector P1
10. have all the features that a standard BDM has in debugging the target MCU Also it gains all the features a programmer has for programming the flash memory of the MCU on the target board another Dragon12 Plus board To use the master board as a programmer you need a 6 pin ribbon cable to connect from the BDM OUT of the master board to the BDM IN of the target board make sure that the orientation of the cable is correct You don t have to provide the power to both boards but only to one board The master board communicates to a PC COM port while the target board does not need to be connected to a PC COM port After booting up in this mode the LCD should display one of the following two messages If the D Bug12 monitor is erased the LCD will display the following message after reset DRAGON12plus EVB POD Bug12 ERASED Otherwise it will display DRAGON12plus EVB BDM POD MODE and you should see the following message on PC screen Can t Communicate With Target CPU 1 Set Target Speed 48000 KHz 2 Reset Target 3 Reattempt Communication 4 Erase amp Unsecure 3 You first must set the target speed with the choice 1 After entering the first choice you will be prompted to enter the target speed It s the crystal frequency not the bus speed that is boosted up by the on chip PLL After a reset before the PLL is enabled the target 16 MC9S12DG256 is running from the crystal frequency not
11. in the left position MODE select both DIP switches of SW7 are set in the low positions for EVB mode 40 If all above settings are correct and you press the reset button the PBO PB7 LEDs should light up from left to right one at a time and the LCD should display the following message DRAGON12plus EVB D Bug12 EVB MODE If the LEDs lighted up and the LCD displays the following message DRAGON12plus EVB D Bug12 ERASED or RUN USER PROGRAM or enee then the D Bug12 monitor is erased You can re program the D Bug12 in bootloader mode according the instructions on page 19 If the board does not communicate with the PC the COM port number may not be set correctly by AsmIDE If the screen displays some garbled characters the baud rate may not be set correctly The D Bug12 resets the baud rate to 9600 during power up if you changed the baud you must change the AsmIDE s baud rate to the same baud If the PBO PB7 LEDs don t light up from left to right one at a time the bootloader could be erased by aBDM You can use a BDM with instructions from the manufacturer or use another Dragon12 Plus board as a BDM POD to re program bootloader and D Bug12 monitor into flash memory according to the instructions on page 16 The newest firmware can be downloaded at www evbplus com download_hcs12 html 2 Always reset the board before downloading a new program If the previous application program that you ran
12. is done type G 2000 and hit lt Enter gt key to run the test program All sample programs on the CD are developed in RAM You can try to run a different example program later after you have finished reading this manual You should always press the reset button before downloading a new program because the new program may not work if an interrupt was enabled by a previous program All example programs are fully debugged so the assembler won t generate an error If you have an error even a warning error in your program you must correct it before it can generate an s19 file 14 Chapter 3 Software descriptions 3 1 Bootloader and D Bug12 Monitor The MC9S12DG256 on the Dragon12 Plus board is pre loaded with bootloader and D Bug12 monitor firmware and it will operate in 4 different modes depending on the setting of the 2 position DIPswitch SW7 After power up or reset the MC9S12DG256 will read the PADO and PAD1 to decide which mode to boot up The bootloader AN2153 PDF the D Bugi2 reference guide DB12RG4 PDF and the MC9S12DG256 data book MC9SDG256 PDF are the most important documentations They can be found on the folder named C Dragon12P document after software installation The HCS12 instruction set register map and memory map can be found on page 26 65 and 120 of the data book respectively The new D Bug12 V4 x is much different and much larger about 60K than old D Bug12 V2 x The C000 EFFF are just a part
13. the PLL frequency Enter 8000 for the target speed After the correct speed is entered the master will try to communicate with the target board If it s not successful enter choice 2 to reset the target board Can t Communicate With Target CPU 1 Set Target Speed 8000 KHz 2 Reset Target 3 Reattempt Communication 4 Erase amp Unsecure 21 Enter Target Crystal Frequency kHz 8000 Can t Communicate With Target CPU 1 Set Target Speed 8000 KHz 2 Reset Target 3 Reattempt Communication 4 Erase amp Unsecure 22 When the communication is established you will see the following D Bug12 v4 0 0b32 Copyright 1996 2005 Freescale Semiconductor For Commands type Help S gt You will notice that the debug prompt is S gt in the POD mode not just a gt in the EVB mode The S gt tells that this is the POD mode and the MC9S12DG256 on target slave board is stopped Sometimes the prompt could be a R gt that means the target MCU is running If you see the R gt just type reset then lt Enter gt to reset the target and it will come back to the S gt prompt R gt Reset lt Enter gt S gt Note The initial communication in POD mode does not always work smoothly and sometimes the PC screen would only display an incomplete sign on message You need to re start it all over again by pressing reset buttons on both master board and target board then press the Enter key on PC ke
14. via a 16 pin 8X2 cable assembly 2 A solderless breadboard is included for fast prototyping but not shown in the picture on the front page UO Pin Usage Many I O pins of the MC9S12DG256 on the Dragon12 Plus board are used by on board peripherals and it seems that there are only a few of unused pins left for your circuits on the breadboard Fortunately it s unlikely that all on board peripherals will be used by one application program So the I O pins on unused peripheral devices can still be used by your circuits on the breadboard For instance if you don t touch the 4x4 on board keypad the entire port A will be available to your circuits If you don t use the LCD or just unplug the LCD the port K will be available as well Port B drives LEDs but if you ignore the status of the LED the port B can drive any other I O devices on the breadboard Each pin in port H reads a switch but it still can be used as an input for reading a TTL or CMOS output from your circuits 9 Pin Name Pin I O Usage PAO output Pin 57 Col_0 of keypad PA1 output Pin 58 Col_1 of keypad PA2 output Pin 59 Col_2 of keypad PA3 output Pin 60 Col_3 of keypad PA4 input Pin 61 Row_0 of keypad PA5 input Pin 62 Row_1 of keypad PA6 input Pin 63 Row_2 of keypad PA7 input Pin 64 Row_3 of keypad PBO output Pin 24 LEDO or H bridge PB1 output Pin 25 LED1 or H bridge PB2 output Pin 26 LED2 or H bridge PB3 output Pin 27 LEDS o
15. your program you must initialize the interrupt vectors at 3E00 3E7F Use on chip flash for testing your code in BOOTLOADER mode In this mode you download your program directly into on chip flash memory You first erase the D Bug12 monitor portion of flash memory and then program that portion of the flash memory by downloading your application program code in an s29 file Your program will replace the D Bug12 monitor in the flash memory The bootloader portion of the flash memory remains intact To run your code set the mode switch SW 7 to EVB mode then press the reset button It usually runs the D Bug12 monitor but now it runs your program The flash memory is non volatile like the EEPROM Your code will run every time the board is turned on or reset 22 The bootloader redirects interrupts to EF80 EFFF The D BUG12 is not present and the interrupt vectors of your program are at EF80 EFFF The addresses EFFE and EFFF contains the starting address of your program In order to program the MC9S12DG256 flash memory you must program an even number of bytes and begin on an even address boundary for each s record If any one s record in the file contains an odd number of bytes or begins with an odd address the flash memory cannot be programmed If your assembler or compiler cannot generate the even format you must use the Freescale s record conversion utility sreccvt exe to convert your odd format to the even format by using the follow
16. 1 08 Designed for a special customer and was never sold to public 10 06 08 Same as rev D board except 1 2 Most discrete components such as resistors capacitors diodes transistors and LEDs are changed to SMD The temperature sensor is changed from MCP9701A U14 to LM45 U14A Both are the same type of sensors with analog voltage outputs but with different sensitivities The MCP9701A outputs 19 5mV per degree C while the LM45 outputs 10mV per degree C 42
17. 12 portion of flash memory it wipes out the D Bug12 monitor You can restore it any time just as if you were downloading another application program since the bootloader is not erased You can erase and program the D Bug12 monitor portion of the flash memory of the MC9S12DG256 on its own board in bootloader mode but you cannot erase and program bootloader by itself The bootloader can only be erased by an external BDM via BDMin port After booting up in this mode the LCD should display the following message DRAGON12plus EVB BOOT LOADER and you should see the bootloader menu on PC screen MC9S12DG256 bootloader menu a Erase Flash b Program Flash c Set Baud Rate d Erase EEPROM 3 The option a will erase the D Bug12 portion of flash memory not the bootloader itself The option b will program the D Bug12 portion of flash memory not the bootloader itself The file to be programmed into flash memory must be an s2 record file If your assembler and compiler generate s1 record files only you must convert an s1 record file to an s 2 record file before programming flash memory with the bootloader 19 The option c will set a new baud rate The option d will erase all on chip EEPROM Note Some users may accidentally erase the D Bug12 monitor when entering this mode so it is important to know how to re program the D Bug12 monitor To program flash memory with the D Bug12 monitor 1 Enter the option a to era
18. 3 PTT DORT t PTS se PMO ae PMI PM2 PMS we Pld PMS gt PMG PM PTM PJO PJI gt PJG PJ PPO e PPI gr PP2 mes PPS res PP4 PPS PPE jee PPT PHO PHT PH2 PH3 PHS PHS res PH6 res PHI Signals shown in Bold are not available on the 80 Pin Package DDRJ PTJ DDRP PTP DDRH PTH 551 PWM3 KWP3 PP3 SCK1 PWM2 KWP2 PP2 MOSI MISO MODC TAGHI BKGD 1 PWM1 KWP1 PP1 1 PWMO KWPO PPO XADDR17 PK3 XADDR16 PK2 XADDR15 PK1 XADDR14 PKO IOCO PTO IOC1 PT1 IOC2 PT2 IOC3 PT3 IOC4 IPT4 IOCSIPTS C IOC6 PT6 C IOCTIPTT C XADDR19 PK5 ONDAN Be SE SE 2 22 osa SBE amp NN Bing SKEEEER Zz 2085 ZS E E E ON ZS ss22 SSSSsF 53 Foor SEEREEREES SO S222 88228253 BE Sie e e Cl ei x S S gage SS SC Si zZz Zen LELEL esorreexsat Se 52 3 LLLLLL22RFBSS2229ER2 9 SC SSR SESESESSUBSSSZRSEBRE FHBSLFRHOHNSHASSFSHSSREWRESHFAAHSSREG I oo BD SOS ZZ SS SENDAN DEZAKE Edert EE te E sr 88588388858885 aS s 8 8 ree nee MC9S12DP256B MC9S12DT256 IMC9S12DJ256 MC9S12DG256 XADDR18 PK4 C 20 KWJ1 PJ41 KWJO PJO C 22 ADDRO DATAO PBO RANIPE2 IRQIPE1 XIRQIPEO SCK2 KWH6 PH6 MOSI2 KWHS PH5 MISO2 KWH4 PH4 SS1 KWH3 PH3 SCK1 KWH2 PH2 MOS 1 KWH1 PH1 SS2 KWH7 PH7 ADDRS DATA5 PB5 ADDRG6 DATA6 PB6 ADDR7 DATA7 PB7 XCLKS NOACC PE7 MODB IPIPE1 PE6 MODA IPIPEO PE5 MISO1 KWHO PHO LSTRB TAGLO PE3 VRH VDDA PAD15
19. AN15 ETRIG1 PADO7 ANO7 ETRIGO PAD14 AN14 PADOG ANO6 PAD13 AN13 PADOS ANO5 PAD12 AN12 PADO4 AN04 PAD11 AN11 PADO3 ANO3 PAD10 AN10 PADO2 ANO2 PADOS AN09 PADO1 ANO1 PADOS ANO8 PADOO ANOO VSS2 VDD2 PA7 ADDR15 DATA15 PAG ADDR14 DATA14 PAS ADDR13 DATA13 PA4 ADDR12 DATA12 PA3 ADDR1 1 DATA11 PA2 ADDR10 DATA10 PA1 ADDR9 DATAS PAO ADDR8 DATA8 Signals shown in Bold are not available on the 80 Pin Package Fig 1 3 MC9S12DG256 MCU pin assignments 1 3 On board hardware features The Dragon12 Plus board includes the following features 1 2 3 4 5 6 7 8 9 1 CAN port 0 Eight LEDs Dual RS232 communication ports RS485 communication port DS1307 RTC with backup battery included for testing IC interface IC expansion port for interfacing external IC devices SPI expansion port for interfacing external SPI devices Dual 10 bit DAC for testing SPI interface and generating analog waveforms Four robot servo controllers with terminal block for external 5V Four digit 7 segment LED display for learning multiplexing technique 1 4 33 Eight position DIP switch Four push button switches 5V regulator with DC jack and terminal block for external 9V battery input Speaker to be driven by timer or DAC or PWM signal for alarm or music applications Dual H Bridge motor driver with motor feedback or rotary encoder interface for controlling two DC motors or one Stepper motor Power On LED indicator IR tr
20. CS of LTC1661 DAC PM7 Pin 87 I O for external SPI J10 PPO output Pin 4 Digit 3 of 7 segment display or EN12 of H bridge PP1 output Pin 3 Digit 2 of 7 segment display or EN34 of H bridge PP2 output Pin 2 Digit 1 of 7 segment display PP3 output Pin 1 Digit O of 7 segment display PP4 output Pin 112 Servo motor 1 PP5 output Pin 111 Servo motor 2 PP6 output Pin 110 Servo motor 3 PP7 output Pin 109 Servo motor 4 PSO Pin 89 SCIO for PC communication RECV DB9 connector P1 PS1 Pin 90 SCIO for PC communication XMIT DB9 connector P1 PS2 Pin 91 SCI1 for user applications RECV selected by J23 PS3 Pin 92 SCI1 for user applications XMIT PS4 Pin 93 MISO for LTC1661 SD memory interface and external SPI J10 PS5 Pin 94 MOSI for LTC1661 SD memory interface and external SPI J10 PS6 Pin 95 SCLK for LTC1661 SD memory interface and external SPI J10 PS7 Pin 96 I O for external SPI J10 PTO input Pin 9 Rotary encoder PT1 input Pin 10 Rotary encoder PT2 Pin 11 not used PT3 input Pin 12 IR RECV when jumpers on J27 set for PT3 and PT4 PT4 output Pin 15 IR XMIT when jumpers on J27 are set for PT3 and PT4 PT5 output Pin 16 Speaker output PT6 output Pin 17 BDMout reset used in POD mode only PT7 Pin 18 BDMout data line bi directional used in POD mode only PADO Pin 67 D bug12 mode select SW7 PAD1 Pin 69 D bug12 mode select SW7 PAD2 Pin 71 Alarm trigger1 analog or digital input PAD3 Pin 73 Alarm trig
21. DA32DA3AD9FAD9F2D9AFD98AD9D5EF00EF00EF0039 S9030000FC We are not going to explain the s record format here If you would like to know more on the subject you can review the D Bug12 reference guide on the CDROM BD12RG4 PDF It explains the subject in great details Right now all you need to know is that an s1 record file must be converted to an s2 record file before using the FLOAD command The FLOAD command in the D Bug12 is for downloading an s2 record file Our Dragon12 bootloader is modified from the Motorola s BootDP256 asm We added our modification to the original source code and the s record file is generated by the AsmIDE It s an s1 record file and we converted it into an s2 record file by using the following commands Sreccvt m c0000 fffff 32 of 0000 o Boot_DR12_8MHz s29 Boot_DR12_8MHz s19 Now we type FLOAD lt Enter gt at the prompt Click the Build button select the Download option and select the file named Boot_DR12P_8MHz s29 located in the folder named D Bug12_Monitor You should see the following on the terminal window when programming is done when the prompt s gt appears S gt fload lt Enter gt kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk S gt Now we are going to program the D Bug12 monitor into the flash memory We need to type FLOAD lt Enter gt at the prompt Click the Build button select the Download option and select th
22. DRAGON12 Plus Trainer For Freescale HCS12 microcontroller family User s Manual for Rev F board Revision 1 06 s 2 iseeeeeere EESTLASI FIERTE LEPI d i Ka s p DRAGUN PoORLUL B sw i Sa Table OF Contents Chapter 1 1 1 1 2 1 3 1 4 Chapter 2 2 1 2 2 2 3 Chapter 3 3 1 3 2 3 3 Chapter 4 4 1 4 2 4 3 44 4 5 4 6 4 7 4 8 4 9 dee Her e VE 4 VUE E 4 MC9S12DG256 features and memory Map aaa aaa naa aaa naa aan naa 5 On board hardware features aaa aaa nana sana sana aaa anna nana 8 VO pin usage z ca nanena odaou dd accescieveuasabersucuend ecktieesstaseesecetcuesinsisiantveentsectineaade 9 Quick Starta Draai a o dg te cd acca asia secede i ado apada a 12 Install software from le KE 12 Getting Started oc lok add kan ik da tad ada ka ava na dani dani 12 Test hardware aaa ananasa anna 14 Software DeSriptions aaa ana ananasa anna 15 Bootloader and D BUG12 monitor aaa aaa nana aaa aaa ananasa nana 15 3 11 EVB mode o o a dl es e dij da danaa s ko eia 15 3 1 2 Jump to EEPROM mode aaa aaa aaa aaa nasa 16 3 13 BDM POD Mode i siisii la e aa da ak vida va a kidati ian 16 3 1 4 Bootloader mode EEN 19 Making a simple assembly program in RAM aaa vana aaa aaa aaa nana aa annnaana 20 Software development aaa aaa aaa aan ananasa anna 22 Hardware DescriptiONS aaa ananasa 24 EES eegene eege eege Eeer 24 DIP Switch and pushbuttons ananasa 24 7 segment LED Multiplexing
23. EFC6 Pulse accumulator B overflow EFC8 er er SEFCE er er sz es CH SEFOA SFOC e SEFED SEFEZ SEFE re SEFES SEFER SEFEC SEFEE er MSCAN 0 receive EFB2 IRQ SEFF2 E ee SEFFA Clock monitor fail reset EFFC SEFFE Fig 8 4 MC9S12DG256 secondary interrupt vector table 39 8 3 Useful web links 8 4 The web is the best source for getting more information about the HCS12 The Freescale web site has all documents and application notes that you need The HC12 user group hittp groups yahoo com group 68HC12 and Freescale s forums http forums freescale com freescale are good places to ask a question and get a prompt answer from many other HC12 users You also can visit our web site at http www evbplus com hc11_68hc11_hc12 68hc12 9s12 hcs12 sites html to get links to many university web sites that offer course materials and lab assignments for the Dragon12 and Dragon12 Plus boards All HCS12 boards that are pre loaded with Freescale serial monitor bootloader and D Bug12 monitor on the market today are basically the same products as far as software development is concerned If you are going to use a BDM to debug a HCS12 board all HCS12 boards will respond to all BDM commands in the same manner because the BDM directly communicates with the MC9S12DG256 MCU The information on our manual can apply to the boards from other manufacturers and vice versa Troubleshooting notes The following
24. L CCIE CBEIE BA FFB8 FFB9 Bit FCTL CCIE CBEIE B8 FF90 FF91 CAN4 transmit FF8E FF8F Port P Interrupt SFF8C FF8D PWM Emergency Shutdown FF80 to CANATIER TXEIE2 TXEIE0 PTPIF PTPIE PWMSDN PWMIE 8C Reserved FFB6 FFB7 CANO wake up I Bit CANORIER WUPIE B6 FFB4 FFB5 CANO errors LEI CANORIER CSCIE OVRIE B4 FFB2 FFB3 CANO receive L t CANORIER RXFIE B2 FFBO FFB1 CANO transmit L t CANOTIER TXEIE2 TXEIEO B0 FFAE FFAF CAN1 wake up I Bit CAN1RIER WUPIE SAE CANT errors CAN1RIER CSCIE OVRIE AC SRA lt CANTrecave Bit CANIRIER RXFIE SAA CANT transmi sA CAN2 wake up CAN2RIER WUPIE A6 CAN2 errors CANZRIER CSCIE OVRIE A4 FFA2 FFA3 CAN2 receive CAN2RIER RXFIE A2 CAN2 transmit CANZTIER TXEIE2 TXEIE0 A0 CAN3 wake up CAN3RIER WUPIE 9E FFOC FF9D CAN3 errors CAN3GRIER TXEIE2 TXEIE0 9C CAN receive CAN3RIER RXFIE 9A CAN3 transmit CANSTIER TXEIE2 TXEIE0 98 GANARIER WUPIE 96 CANGRIER CSCIE OVRIE SFFBC SFFED FF92 FF93 CAN4 receive CAN4RIER RXFIE I Bit e 0 Ku is Fig 8 3 MC9S12DG256 Interrupt vector table 2 Secondary Secondary Interrupt Source Vector Interrupt Source Vector Address Address Reserved FF80 EF80 EFCO Reserved FF84 EF84 SCME EFC4 Reserved FF86 EF86 CRG lock
25. PC via SCIO the PWR LED will grow brighter momentarily 4 12 RS485 communication port U5 SN75176 converts the TTL signal from SCI1 to RS485 differential signals and vice versa PJO pin 22 of the MC9S12DG256 is used to control the direction of RS485 communication If PJO 0 the RS485 port U9 DS75176 is set as a receiver port If PJO 1 the RS485 port U9 DS75176 is set as a transmitter port 4 13 External SPI interface SPI port J10 pinouts are as follows Pin 1 VCC 5V Pin2 VCC 5V Pin 3 PM7 LOAD Pin4 PS4 SPI DATA IN Pin 5 PS7 STROBE Pin6 PS5 SPI DATA OUT Pin 7 PE1 IRQ Ping PS6 CLOCK Pin9 GND Pin10 GND 4 14 External TC interface I2C port J2 pinouts are as follows Pin 1 VCC 5V Pin2 IRQ Pin 3 PM7 SCL Pin4 PS4 SDA Pin 5 GND 29 4 15 All jumper settings All on board jumpers J1 J2 J3 J4 J19 J20 J21 J22 J23 J24 J25 J26 Enables the LCD backlight DC interface Connection of the terminating resistor for CANO Place a jumper on this header only if you use CANO It will save power consumption of the board without the jumper if CANO is not used Two channel 10 bit DAC outputs The output A is also available between PJ6 of H8 and PJ7 of H7 The output B is also available between GND of H1 and PT4 of H2 HAN of LCD module It s hardwired for write only PP4 PWM output for Robot servo PP5 PWM output for Robot servo PP6 PWM output for Robot servo PP7 PWM output f
26. Public License http Awww geocities com englere_geo License txt The steps to set up the EmbeddedGNU are as follows 1 Download the GNU GCC compiler from http m68hc1 1 serveftp org m68hc11_ pkg zip php Select the release 3 1 to download It has the following components in it DC 3 3 6 Gdb 6 4 Binutils 2 15 Newlib 1 12 0 2 Run the file that you downloaded to install GNU 68HC11 68HC12 tools into the default directory of C usr 3 Install the EmbeddedGNU on your PC by double clicking on the egnu094 zip If the egnu094 zip is not on the CD you can download it from http Avww ericengler com EmbeddedGNU aspx Extract all files into a new directory that you need to create on any hard drive The name of the new directory can be like c egnu094 or d egnu094 The EmbeddedGNU exe and example programs will be located at egnu094 but your application programs can be located in any other directories 4 Filename Association When you first start EmbeddedGNU exe it will ask if you want to associate the filename extensions used by EmbeddedGNU with itself This lets you double click on a filename and the EmbeddedGNU will be launched to let you edit the file The default option is to associate prj with EmbeddedGNU This is the main project file type used by EmbeddedGNU You also should choose to associate c h and s files with EmbeddedGNU WARNING if you are on WinNT Win2K WinxXp then you must be logged in as an administrator to use this op
27. Test_DR12P_8MHz s29 which is included in the CD and also available on our web site at http Awww evbplus com download hces12 download_hcs12 html Some universities use Code Warrior IDE only In this case we pre load the on chip flash memory with serial monitor If your board is pre loaded with D Bug12 monitor the Port B LEDs will light up from LEFT to RIGHT one at a time and the speaker will chirp once when the board is turned on If the chirp is too soft you can remove the sticker on the speaker to increase volume If your board is pre loaded with Serial Monitor the Port B LEDs will light up from RIGHT to LEFT one at a time and the speaker will chirp once when the board is turned on To distinguish RUN mode from LOAD mode Port B LEDs will light up again from LEFT to RIGHT one at a time in RUN mode The left DIP switch of SW7 is used to select RUN or downLOAD mode The left DIP switch is set in the up position for RUN mode and in the low position for downLOAD mode 34 We will add setup procedures for Code Warrior in the future Our web site provides links to many university web sites and you can visit those web sites for more information http Awww evbplus com Code Warrior hcs12 html Following is the web site for downloading the free Code Warrior special edition http Awww freescale com webapp sps site overview isp nodeld 01272600610BF1 Following is the web site for downloading the Code Warrior full edition for a 30 day
28. al To change the linker search directory search path for GNU C compiler toolset you click on options gt project options gt edit profile As it can be seen from above Linker Search Directory the GCC 3 3 6 is installed on C drive Some university web sites offer educational resource for the EmbeddedGNU The following web site provides A C sample program for the DRAGON12 board using EmbeddedGNU and GCG York University s CSE4080 computer science project http Awww gcc hcs12 com index php provides easy to use open source and GPL type resources for the HCS12 family 33 Chapter 6 Code Warrior and Serial monitor Code Warrior is a very powerful and professional IDE The main feature of Code Warrior IDE is the source level debugger in assembler and C Code Warrior Special Edition is a wonderful gift from Freescale to all of us and it s free for educational use What s more by Code Warrior supporting serial monitor they have made it very affordable to support Code Warrior for the OEM Freescale has invested millions of dollar into Code Warrior and the current versions work very well What s more Freescale knows they will never sell enough copies of Code Warrior to make back what they have invested They did it to drive chip sales As a software developer the first thing you look at is available tools and what it will cost There are many companies making MCU chips these days and for the most part they all have about the sa
29. ansceiver with on board 38KHz oscillator BDM in connector to be connected with a BDM from multiple vendors for debugging BDM POD mode for programming other HCS12 boards No extra hardware needed Opto coupler output Logic probe with LED indicator Abort switch for stopping program when program is hung in a dead loop Mode switch for selecting 4 operating modes EVB Jump to EEPROM BDM POD and Bootloader 4X 4 keypad Form C relay output rated at 3A 30V or 1A 125V Relay On LED indicator X Y Z accelerometer interface or GP2 D12 distance measuring sensor interface for distance measurement Potentiometer trimmer pot for analog input Temperature sensor Communication port for VGA camera with built in JPEG compression Camera is optional Light sensor Female and male headers provide shortest distance great for high speed applications from bread board to every I O pin of the MC9S12DG256 PC board size is 8 4 X 5 35 The Dragon12 Plus board has the following features as options 34 35 36 37 RF transmitter RF receiver SD memory interface VGA camera with JPEG compression The Dragon12 Plus board includes the following features but not shown in the picture on the front page of this manual 1 A 16X2 LCD display module with LED backlight is included for learning LCD interface software but not shown in the picture on the front page It can be replaced by any size of LCD display module
30. are some important notes that you should know and they may save you time 1 Things to do if the board does not work Many little mistakes can cause a big problem especially for beginners For instance if you want to run the board in single chip mode but MODEB A and C are set for expanded mode you know it won t work If the jumper on J1 is missing the LCD backlight won t work and if the jumper on J24 is missing the 7 segment display won t be lit Before troubleshooting the board you must apply power to the board When the board is powered the PWR LED indicator must be on If it s off the board does not have 5V DC Sometimes it may be caused by a bad AC adapter or the AC adapter may not even be plugged in To determine if the board malfunctions you can restore the following jumper settings to the original default settings when you receive the board The default settings are as follows JI J3 J18 J23 J24 J25 J26 J27 J29 J35 SW7 Enables the LCD backlight Jumper is installed No jumper VCC for H bridge U12 SN754410N No jumper SCI1 receiver select jumper is set for IR in the bottom position 7 segment_EN jumper is on DC motor power select Jumper is placed in the up position Speaker driving source Jumper is placed in the top position driven by PT5 IR select both jumpers are placed in the up positions SCI1 receiver select no jumper Servo motor power select jumper is placed
31. by RAM variables as shown by org 1000 count rmb 1 reserve one byte of RAM for temp storage temp rmb 2 reserve two bytes of RAM for temp storage If your program is small say less than 4K you can start your program at address 2000 with the statement org 2000 followed by your program as shown by org 2000 It will assemble your source program and generate hex code within 4K locations from 2000 to 2FFF Here is a very simple program but it s complete It will flash the PBO LED at 2Hz when it s running The RAM byte named counter is added for demonstrating how a RAM data byte is used in a user program In this simple program it s not really necessary because the accumulator A can be used as the RAM byte counter 20 For a good programming practice you should always place the Ids instruction in the first line of your code include reg9s12 h REGBLK equ 0000 STACK equ 2000 do not use 4000 org 1000 counter rmb 1 org 2000 program code start Ids STACK Idx REGBLK aa ff staa ddrj x make port J an output port staa ddrb x make port B an output port staa ddrp x make port P an output port staa ptp x turn off 7 segment LED display clr ptj x make PJ1 low to enable LEDs back clr portb x turn off PBO jsr d250ms delay 250ms inc portb x turn on PBO jsr d250ms delay 250ms jmp back d250ms Idaa 250 delay 250 ms staa counter delay1 Idy 6000 6000 x 4 24 000
32. d debug it with the D Bug12 monitor in this mode You must place your interrupt vectors at 3E00 3E7F because real interrupt vector addresses are taken by the bootloader The bootloader and the D Bug12 monitor will redirect interrupts to the RAM interrupt vector addresses at 3E00 3E7F Because RAM will lose its contents after power off you have to load your program every time after power up In the beginning of your program you must initialize the interrupt vectors at 3E00 3E7F In all sample programs the user program code locations are at 2000 3FFF The user data RAM locations are at 1000 1FFF The 64 RAM interrupt vector addresses are at 3E00 3E7F The 64 RAM interrupt vector addresses 128 bytes of RAM are assigned by the D Bug12 monitor to different interrupt sources The listing of interrupt sources is show on chapter 8 Use on chip 3K EEPROM for testing your code in EVB mode If your program is small enough to fit into a 3K range then you can download your code into the EEPROM In this way your program can be auto started from 0400 upon reset You cannot set software breakpoints and single step in the EEPROM in EVB mode so it makes sense to do development work in the RAM When your code is completely debugged then re assemble or re compile it at 0400 and download the final s19 file into the EEPROM for the auto start feature Like the RAM based development your interrupt vectors are at 3E00 3E7F In the beginning of
33. e file named DBug12v32_DR12P_8MHz located in the folder named D Bug12_Monitor You should see the following on the terminal window when programming is done when the prompt s gt appears S gt fload lt Enter gt kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk kkk kk kk kk kk k k kk kk kk kk k kk kkk k kk kkk k kk kkk kk kk kk kkk kkk kk kk kk kk kkkkkkkkkkkkkkkkk kkk kkk kkk kkk kkk kkk kk kkk kkk kkk kkk kkk kk kkk kk kkkk kkk kkk kk kkkkkkkkkkkkkkkkkkkkkkk kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk Kk kk kk k k k k kk k k kk kk k k kk k kk kkk k kk kkk k kk kkk kk k kkk kkk kkk kk kkk kkk kkk kkk kk kkk kk ERE kkk kkk kk kk kk kk kk kk kk kkk kkk kkk kkk kkk kk kkk kk k kkk kkk kkk kk kkkkkkkkkkkkkkkkkkkkkkk kkk kk kk kk kk kk kk kk kk kk k kk kkk k kk kkk k kk kkk kk k kkk kkk kkk kk kk kk kk kkkkkkkkkkkkkkkkk kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk S gt 18 With the bootloader and the D Bug12 programmed in the flash memory the target board now becomes a true development board That s how we program the board before we ship it Your Dragon12 Plus board actually becomes a programmer You can then repeat above steps as many times as you want Just unplug the 6 pin BDM cable from the target
34. free evaluation http Awww freescale com webapp sps site overview isp nodeld 01272600612247 Chapter 7 PLL code start The crystal frequency on the Dragon12 Plus board is 8 MHz so the default bus speed is 4 MHz In order to set the bus speed high than 4 MHz the PLL must be initialized You can cut and paste the following code to the beginning of your program The math used to set the PLL frequency is PLLCLK CrystalFreq 2 initSYNR 1 initREFDV 1 CrystalFreq 8 MHz on Dragon12 plus board intSYNR 5 PLL multiplier will be 6 intREFDV 1 PLL divisor will be 2 PLLCLK 8 2 6 2 48MHz The bus speed PLLCLK 2 24 MHz PLL code for 24MHz bus speed from a 4 8 16 crystal sei Idx belr bset Idaa staa Idaa Idaa Idaa staa wait_b3 brclr bset 0 clksel x 10000000 clear bit 7 clock derived from oscclk pllctl x 01000000 Turn PLL on bit 6 1 PLL on bit 6 0 PLL off 05 5 1 6 multiplier synr x 03 divisor 3 1 4 16 2 6 4 48MHz PLL freq for 16 MHz crystal 01 divisor 1 1 2 8 2 6 2 48MHz PLL freq for 8 MHz crystal 00 divisor 0 1 1 4 2 6 1 48MHz PLL freq for 4 MHz crystal refdv x crgflg x 00001000 wait_b3 Wait until bit 3 1 clksel x 10000000 35 Chapter 8 Appendix 8 1 D Bug12 utility routines The AN1280 was written for OLD 68HC12 family If you happen to use printf routine with your old 68HC12 board you should be aware that I O utility routines are mo
35. ger2 analog or digital input PAD4 Pin 75 Light sensor phototransistor Q1 PAD5 Pin 77 Temperature sensor U14 MCP9701A PAD6 Pin 79 Not Used PAD7 Pin 81 Trimmer pot VR2 PAD8 Pin 68 X axis input for Wytec accelerometer or ADC input for GP12D2 PAD9 Pin 70 Y axis input for Wytec accelerometer or ADC input for GP12D2 PAD10 Pin 72 Z axis input for Wytec accelerometer or ADC input for GP12D2 PAD11 Pin 74 not used PAD12 Pin 76 not used PAD13 Pin 78 not used PAD14 Pin 80 not used PAD15 Pin 82 not used Table 1 2 I O pin usage list 2 11 Chapter 2 Quick Start By default the Dragon12 Plus board is pre installed with the bootloader Freescale AN2153 pdf and the D Bug12 monitor Freescale DB12RG4 pdf In chapters 2 and 3 the AsmIDE is used as the main software tool to develop and debug assembly programs If you prefer to use Code Warrior IDE for C program development and your board is pre installed per your request with the serial monitor Freescale AN2548 pdf skip the chapters 2 and 3 after installing software from CD People often use different terminologies In our product manuals Download means to transfer a file from PC to a development board while Upload means to transfer a file from a development board to PC Through out the manual left click means that you click the left button of the mouse and right click means that you click the right button of the mouse 2 1 Install software from CD After downloading the CD fr
36. have a jumper at the same time If a VGA camera is used move this jumper to J29 Enables 7 segment LED display driver U6 74HC367 7 segment LED display and H bridge driver should not be enabled at the same time If H bridge driver is used move this jumper to J18 otherwise leave the jumper on this header DC motor power select The jumper is placed in the up position if motors are powered by the on board unregulated 9V VIN The jumper is placed in the low position if motors are powered by external 9V at pin 1 of the terminal block T4 Selects speaker driving source The speaker can be driven by PT5 OC3 PP5 PWM and DAC B 30 J27 J28 J29 J30 J31 J32 J33 J34 J35 J36 J37 IR transceiver control source select When the jumpers are placed vertically in the up positions labeled with PS2 and PS3 The PS3 TXD1 of SCI1 drives the IR transmitter and the PS2 RXD1 of SCI1 receives data from the IR detector The PS3 and PS2 can be programmed as general I O lines or a SCI UART When the jumpers are placed vertically in the low positions labeled with PT4 and PT3 the PT4 drives the IR transmitter and the PT3 receives data from the IR detector VGA camera interface SCI1 s PS2 receives signal from VGA camera J29 and J23 cannot have a jumper at the same time If VGA camera is not used move this jumper to J23 Mode B select a solder bridge on solder side it defaults at 0 Do not change i
37. ine sets DAT low and PAO PA2 PAS high then tests PA4 PA7 If no key is down PA4 PA7 remain high If PA7 low the key 7 is down If PA6 low the key 6 is down If PA5 low the key 5 is down If PA4 low the key 4 is down 26 45 4 6 4 7 Keypad scan routine sets PAO low and DAT PA2 PAS high then tests PA4 PA7 If no key is down PA4 PA7 remain high If PA7 low the key 3 is down If PA6 low the key 2 is down If PA5 low the key 1 is down If PA4 low the key 0 is down LCD display Port K is an 8 bit bi directional port It s used for the LCD display module If the port is not used for the LCD display it can be used as a general purpose I O port The pinouts of J11 and J12 are as follows Pin 1 GND Pin 2 VCC 5V Pin3 Via a 220 Ohm resistor to GND Pin 4 PKO RS pin for LCD module Pin 5 PK7 RW pin for LCD module Pin6 PK1 EN pin for LCD module Pin 7 Not used Pin 8 Not used Pin 9 Not used Pin 10 Mot used Pin 11 PK2 DB4 pin for LCD module Pin 12 PK3 DB5 pin for LCD module Pin 13 PK4 DB6 pin for LCD module Pin 14 PK5 DB7 pin for LCD module Pin 15 Via a 22 Ohm resistor to VCC LED backlight for LCD module Pin 16 GND Please notice that PK2 PK5 not PK4 PK7 are used to drive DB4 DB7 of the LCD module The LCD module is hardwired for write only operation Experienced user can cut a trace between pin 2 and pin 3 of J5 on solder side then install a 3 pin male header on J5 to make it for both read
38. ing command line Sreccvt m c0000 fffff 32 of 10000 o test s29 test s19 It will create a new file named test s29 that has the even format and can be programmed into flash memory For your convenience the sreccvt exe is included in the folder named CDROM document Sreccvt GUI 23 Chapter 4 Hardware Descriptions The crystal frequency is 8 MHz and usually it will result in a 4 MHz bus speed but on this board the MC9S12DG256 s internal PLL boosts the bus speed up to 24 MHz The circuit is designed in such way that the value of all resistors and capacitors are not critical with the exception of R10 and C36 which determine the 38KHz for IR transmitter 4 1 LEDs 4 2 4 3 Each port B line is monitored by a LED In order to turn on port B LEDs the PJ1 pin 21 of MC9S12DG256 must be programmed as output and set for logic zero DIP switch and pushbuttons Port H is connected to an 8 position DIP switch The DIP switch is connected to GND via the RN9 eight 4 7K resistors so it s not dead short to GND When port H is programmed as an output port the DIP switch setting is ignored but for the best result all 8 DIP switches should be open at the up positions 7 Segment LED multiplexing There are 4 digits of 7 segment LEDs on the Dragon12 Plus board The type of the 7 segment LED on board is called common cathode In an individual digit all anodes are driven individually by an output port and all cathodes are interna
39. llers have the same features If you don t use more than 2 CAN ports these two chips are identical and all datasheets and manuals for the DP256 can be used for the DG256 If your application that needs more than two CAN ports please contact us at sales evbplus com and we may be able to ship the board installed with the DP256 The MC9S12DG256 microcontroller consists of a powerful 16 bit CPU central processing unit 256K bytes of flash memory 12K bytes of RAM 4K bytes of EEPROM and many on chip peripherals The main features of the MC9S12DG256 are listed below Powerful 16 bit CPU 256K bytes of flash memory 12K bytes of RAM 4K bytes of EEPROM SCI ports SPI ports CAN 2 0 ports C interface 8 ch 16 bit timers 8 ch 8 bit or 4 ch 16 bit PWM 16 channel 10 bit A D converter Fast 25 MHz bus speed via on chip Phase Lock Loop BDM for in circuit programming and debugging 112 pin LQFP package offers up to 91 I O in a small footprint 0000 0400 1000 4000 8000 C000 SFFO SFFF 0 EXPANDED NORMAL SPECIAL SINGLE CHIP SINGLE CHIP Assuming that a 0 was driven onto port X bit 7 during MCU is reset into normal expanded wide or narrow mode Fig 1 1 MC9S12DG256 Memory map REGISTERS Mappable to any 2k Block within the first 32K 4K Bytes EEPROM Mappable to any 4K Block 12K Bytes RAM Mappable to any 16K and alignable to top or bottom 16K Fixed Flash Page 3E 62 This is dependan
40. lly connected together Before sending a number to a 7 segment LED the number must be converted to its corresponding 7 segment code depending how the 7 segment display is connected to an output port The Dragon12 Plus board uses port B to drive 7 segment anodes and uses PPO PP3 to drive common cathodes We will explain how to multiplex 7 segment by displaying the number 1234 on the display By convention the 7segments are called segment A B C D E F and G Their locations in the display are shown below The segment A B C D E F G and Decimal Point are driven by PBO PB1 PB2 PB3 PB4 PB5 PB5 and PB7 respectively The hex value of the segment code is shown in the following table 24 Number DP GIF EI DICI B A Hex Value 1 0 0 0 0 0 1 1 0 06 2 ODER 5B 3 ODER 4F 4 O 1 1 0 0 1 1 0 66 The schematic for multiplexing 4 digits is shown below The two of the digits at the right are deliberately placed upside down and the hardware connections compensate for this configuration The reason for the upside down digits is to place two decimal pointers on the middle as a colon for a clock display COMMON CATHODE
41. me features at a similar price Special Edition Code Warrior sets Freescale apart from others Code Warrior IDE does not work with D Bug12 but it works with serial monitor Before Freescale created the serial monitor a BDM is needed as an interface between the PC and HCS12 Freescale created the serial monitor for working with Code Warrior to eliminate the cost of a BDM Now a student can use the serial monitor with Code Warrior to debug his program and in fact many universities have been using the serial monitor with Code Warrior without a BDM in their classrooms Without spending money on a BDM a student will be able to spend his savings on purchasing a more advanced trainer like the Dragon12 Plus board with many on board peripherals Purchasing an EVB board that comes with a BDM at a reasonable price most likely leaves the student with an EVB of only limited functionality Some universities use D Bug12 monitor first then replace the D Bug12 monitor with serial monitor to be used with Code Warrior IDE In this case a school laboratory only needs to have one BDM or use one Dragon12 Plus board as a BDM POD to program all students boards with serial monitor To replace bootloader and D Bug12 monitor with serial monitor you need a BDM or a BDM POD to perform the task The procedure to program the on chip flash memory is shown on page 16 The file name of the latest serial monitor including a self test program for the Dragon12 board is SM_and_
42. mode you cannot erase or program on chip flash memory If the D Bug12 monitor is erased the LCD will display the following message after reset DRAGON12plus EVB D Bug12 ERASED You can use bootloader to re program D Bug12 monitor into flash memory Note Some user may accidentally erase D Bug12 monitor in bootloader mode so it is important to know how to re program D Bug12 monitor in bootloader mode 15 3 1 2 3 1 3 Jump to EEPROM mode PAD1 0 PADO 1 This mode enables the MC9S12DG256 to jump directly to the internal EEPROM at location 0400 upon reset This mode makes the MC9S12DG256 a replacement for the old 68HC811E2 microcontroller but it also gives you 3K EEPROM instead of 2K EEPROM with the 68HC811E2 The bus speed is 4MHz one half of the crystal frequency by default the PLL function must be initialized by user s code for a higher bus speed because the D Bug12 monitor firmware that boosts bus speed to 24 MHz is bypassed If you need to auto start your code upon reset the procedure is available in the folder named eeprom_programming After booting up in this mode the LCD should display the following message DRAGON12plus EVB JUMP TO EEPROM BDM POD mode PAD1 1 PADO 0 In this BDM POD mode the D Bug12 firmware acts as a master to access all target MCU resources on the target board another Dragon12 Plus board via the BDM port in a non intrusive manner It becomes a BDM that will
43. nced ready to run sample programs including source code not just Hello World type demo programs The hardware test program test asm simultaneously scans the keypad plays a song multiplexes the 4 LED seven segment display changes display brightness by adjusting the trimmer pot and detects an object by using the IR transceiver as a proximity sensor All sample programs must be run from RAM in EVB mode In order to run the test program in EVB mode the both DIP switches of SW7 must be set in the low positions to match the picture above the SW7 The steps to run your first sample program are as follows 1 Click the File button to open the test asm from c Dragon12P examples After the test asm is loaded into the AsmIDE window you can view instructions of how to test all hardware on the Dragon12 Plus board 2 Click the Build button to assemble code and generate the test s19 file This is how you normally generate an s19 file You can omit this step because the test s19 is already on your hard disk 3 Press the reset button on the board you will see D Bug12 v4 0 0b32 Copyright 1996 2005 Freescale Semiconductor For Commands type Help gt 4 Type LOAD then hit lt Enter gt key 5 Click the Build button Select Download option and locate the file test s19 for downloading If it prompts you with the save changes message you can ignore that message and click the No answer 6 After download
44. nt from the terminal window Some function keys are pre programmed but you can change it any time in configuration options View gt Options gt Terminal Func Keys In the View gt Option gt Assembler menu make sure that the chip family is 68HC12 not 68HC11 If you would like to use your own assembler you can replace the as12 exe with the name of your own assembler 13 10 The screen is divided into two windows The top window is for editing your source code and the bottom window is shared by the message window and the terminal window If the terminal options are set correctly you should see the following prompt every time the reset button on the Dragon12 Plus board is pressed If you do not see this the bottom window may be set for message window Sometime it s a little confusing when terminal window is disabled and the message window does not display what you have typed In order to enable terminal window you have to click the terminal button in the bottom window to enable the terminal window display then move the cursor to any location in the terminal window and click the left button on the mouse After seeing a solid block cursor flashes press the lt Enter gt key and it will enable the terminal window D Bug12 v4 0 0b32 Copyright 1996 2005 Freescale Semiconductor For Commands type Help gt 2 3 Test Hardware To help users get up and running the Dragon12 Plus board comes with many fully debugged some fairly adva
45. ntroller family It is compatible with the Freescale 9512DP256EVB board and other similar development boards on the market today but it also incorporates many on board peripherals that make this board a popular trainer in universities around the world For engineers it is a convenient prototype system suitable for designers who want to rapidly develop and prototype new HCS12 applications For students it can not only to be used as a general trainer for freshman and sophomore students but also as a versatile platform for senior projects as well The new features of the Dragon12 Plus board create a new potential for students at every level The Dragon12 Plus trainer kit comes with the following items 1 Dragon12 Plus board CD Software downloadable from our web site a AsmIDE with HCS12 assembler b Sample programs with source code c Freescale application notes for the HCS12 d Data sheets for on board hardware e User s manual f Reference documents 3 6 foot DB9 cable 4 9V 500mA 1000mA AC adapter for North America customers only We do not offer an AC adapter to customers in other countries because the additional shipping cost of an AC adapter will be higher than if you buy one at a local store If you miss any part of the kit please contact sales EVBplus com or call 630 894 1440 for help Sometime the kit includes two 6 pin IDC connectors at no charge if we have them in stock You may use them to make a BDM cable in the future
46. of the monitor In 16 bit S1 record they are C000 EFFF In 24 bit S2 record they are FC000 FEFFF ppage 3F Since the ppage register deals with the 16K window 8000 BFFF the addresses C000 FFFF are not affected by the ppage The other part of the monitor is at CO000 C87FF 16K window 8000 BFFF when ppage 30 31 and 32 See details on page 20 of the app note AN2153 or page 71 of the D Bug12 v4 reference guide on the CD 3 1 1 EVB mode PAD1 0 PADO 0 This is the standard debug environment running on the MC9S12DG256 for on chip RAM or EEPROM based code development Using an IDE program to view and modify registers and memory locations you may set breakpoints single step through programs and assemble and disassemble code as you would in a BUFFALO monitor based Freescale 68HC11 EVB It gives you 12K RAM and 3K EEPROM to develop and debug your code You must place your interrupt vectors at 3E00 3E7F because real interrupt vector addresses are taken by bootloader bootloader and D Bug12 monitor will redirect interrupts to the RAM interrupt vector table at 3E00 3E7F After booting up in this mode the LCD should display the following message DRAGON12plus EVB D Bug12 EVB MODE and you should see the following message on PC screen D Bug12 v4 0 0b32 Copyright 1996 2005 Freescale Semiconductor For Commands type Help gt Typing help then lt Enter gt will display a list of available commands In this
47. om our web site the installation is automated by double clicking on the SETUP BAT It will create a folder c Dragon12P examples and copy all example program files from the CD to c Dragon12P examples If the filename is only shown as SETUP not SETUP BAT you should change a folder option of the Explorer to show file extension When a file s extension is hiding it is hard to know what it is To have your files to be shown with extensions click on the TOOL tab in Explorer menu then click on folder options then click on view tab finally un check the item named Hide extensions for knowing file types After the software is successfully installed you can make a shortcut to AsmIDE exe on the desktop It s important to make a shortcut so that its target location is C Dragon12P not c Windows desktop or other locations First right click the Start button then left click Explorer left click on CADragon12P right click on AsmIDE exe an application program left click Send to and finally left click Desktop do not click COPY It will create an icon named shortcut to AsmlIDE on the desktop and you can rename it to Dragon12 Plus You can double check the target location by right clicking on the icon then left click on properties You should see that the target location is C Dragon12P If you want to make a shortcut for AsmIDE on the Desktop this is the correct way to do it If you don t follow this method your may
48. on the upper left side of the Dragon12 Plus board and plug the female end of the DB9 cable into COM1 or COM2 port on your PC The DB9 connector P2 on the lower left side of the board is the MC9S12DG256 s SCI1 port that can be used by a user s program To invoke the AsmIDE you can right click the Start button then left click Explorer left click on CA Dragon12P and finally double left click on AsmIDE exe If you have created a shortcut icon on the desktop just double click the AsmIDE icon on the desktop The AsmIDE is simple and very easy to use You only need to use three commands from the AsmIDE for your HCS12 development work Use the File command to edit your source code the Build gt Assemble command to assemble your source code and the Build gt Download command to download an 19 file to the Dragon12 Plus board If your PC has a COM port output it s a 9 pin male DB9 connector you don t need a USB to RS232 converter Usually the PC COM port will be COM1 or COM2 For setting the COM port of the AsmIDE you can click through View gt Option gt Terminal Window Options menu then select the correct COM port and skip the step 6 If your PC does not have a COM port output you have to use a USB to RS232 adapter the COM port number that the AsmIDE uses must match the USB to Serial COM port number that is assigned by Windows O S Windows O S assigns the USB to Serial COM port number randomly and it does not know which COM port n
49. or Robot servo SPI connector On board LCD connector for 16x2 LCD External LCD connector for a LCD module of any size RS of CANO U2 is connected to VSS Connects battery voltage of RTC to low voltage detection It s not connected Connects light sensor to ANO5 of the ADC It s hardwired Connects SQW of the DS1307 to IRQ It s not connected Connects temperature sensor U14 to ANOS of the ADC It s hardwired VCC for H bridge driver U12 SN754410N H bridge driver and 7 segment LED display should not be enabled at the same time Move the jumper from J24 to this header only if H bridge driver is used When H bridge driver is not used move this jumper back to J24 Connects the PS3 TXD1 of SCI1 to all communication hardware RS232 RS485 RF and IR transceiver on this development board BDM input BDM output when the board is booted in POD mode RS485 direction control by PJO pin22 through this jumper SCI1 receiver source select numbering from top to bottom 1 SCI1 s PS2 receives signal from your circuits on the breadboard via pin 91 of header H7 The pin 91 of the U10 DG256 is not connected to header H7 2 SCI1 s PS2 receives signal from P2 the DB9 connector for user RS232 port 3 SCI1 s PS2 receives signal from the terminal block T2 for RS485 port 4 SCI1 s PS2 receives signal from the on board RF receiver 5 SCI1 s PS2 receives signal from the on board IR detector This is the default setting Note J23 and J29 cannot
50. r H bridge PB4 output Pin 28 LEDA PB5 output Pin 29 LED5 PB6 output Pin 30 LED6 PB7 output Pin 31 LED7 PEO input Pin 56 Abort switch SW8 PE1 Pin 55 not used PE2 output Pin 54 Relay DEZ output Pin 53 Opto coupler PE4 Pin 39 not used PE5 Pin 38 not used PE6 Pin 37 not used PE7 Pin 36 not used PHO input Pin 52 DIP switch 1 or pushbutton switch SW5 PH1 input Pin 51 DIP switch 2 or pushbutton switch SW4 input PH2 input Pin 50 DIP switch 3 or pushbutton switch SWS input PH3 input Pin 49 DIP switch 4 or pushbutton switch SW2 input PH4 input Pin 35 DIP switch 5 input PH5 input Pin 34 DIP switch 6 input PH6 input Pin 33 DIP switch 7 input PH7 input Pin 32 DIP switch 8 input PJO output Pin 22 DIR of RS485 PJ1 output Pin 21 LED enable PJ6 Pin 99 SDA for DS1307 U11 or external I2C J2 PJ7 Pin 98 SCL for DS1307 U11 or external I2C J2 PKO output Pin 8 RS of LCD module PK1 output Pin 7 EN of LCD module PK2 Pin 6 DBA of LCD module bi directional PK3 Pin 5 DB5 of LCD module bi directional PK4 Pin 20 DB6 of LCD module bi directional PK5 Pin 19 DB7 of LCD module bi directional PK7 output Pin108 R W of LCD module Table 1 1 I O pin usage list 1 10 Pin Name Pin I O Usage PMO Pin 105 CANO PM1 Pin 104 CANO PM2 Pin 103 Write Enable for SD memory PM3 Pin 102 Card detect for SD memory PM4 Pin 101 CS of SD memory PM5 Pin 100 not used PM6 Pin 88
51. s for port A must be enabled by adding the following instruction at the beginning of your program source code bset pucr 1 enable pull up resistors on port A The PBO PB7 LEDs on the original Dragon12 board prior to rev E board are driven by port B only but they are also controlled by PJ1 on the new Dragon12 plus board In order to turn on PBO PB7 LEDs on the new Dragon12 Plus board the PJ1 pin 21 of MC9S12DG256 must be programmed as output and set for logic zero 09 05 07 arwno No Eliminated low battery detection circuit for easy manufacturing Eliminated VR1 footprint for easy manufacturing Eliminated U4 U17 footprints for preventing solder bridges Eliminated J24B ED EN and rename J24A 7SEG_EN to J24 The headers J20 BDM IN and J21 BDM OUT are rotated by 90 degrees for easy manufacturing Added footprint of a LPF R12 and C26 for RF receiver C37 C38 C39 C40 C41 C42 C43 C44 C45 J28 and J29 are not installed since they are not used by standard features RN11 is not installed and it s replaced by internal pull up resistors 09 26 07 Same as rev C board except 1 2 3 LCD module is hardwired for write only operation Experienced user can cut a trace between pin 2 and pin 3 of J5 on solder side then install a 3 pin male header on J5 to make it for both read and write operations Locations of J1 and J5 are swapped for easy manufacturing Corrected the misprinted label PT6 to PT5 for J26 06 0
52. s with SCIO so the P1 should be connected to a PC s COM port during debugging sessions The SCI1 can be used by user s application programs The receiver of the SCI1 can receive signals from many different devices but only one device at a time or it will cause a signal collision The jumper headers J23 and J29 are used to select which device the SCI1 will receive The J23 selects a signal among your circuits on the breadboard user RS232 RS485 RF receiver and IR detector The J29 selects VGA camera The J23 and J29 cannot have a jumper at the same time If VGA camera is used move the jumper from J23 to J29 otherwise move the jumper from J29 to J23 The 2 pin header above the DB9 connector P1 is connected to the pin 2 and pin 3 of the P1 The correct RS232 level and direction should appear on these two pins during RS232 transmission They can be checked by a scope for diagnostic purposes 28 The Power ON LED indicator located above the 9 pin terminal block T4 also provides another troubleshooting aid During reset in EVB mode the PB7 PBO LEDs will light up from left to right one at atime and then the D Bug12 monitor will transmit a sign on message to PC screen The positive pulse on the RS232 transmitter signal is sent to the Power ON LED through D3 and R22 The PWR LED will grow brighter for 100ms If it does not grow brighter then the U1 SP232 may be defective In summery whenever the Dragon12 Plus board sends a message or data to
53. se D Bug12 portion of flash memory Wait until the bootloader menu re appears after flash memory is erased 2 Enter the option b the bootloader will wait for your file Do not type any thing on keyboard 3 Click the Build button select the Download option and select the file named DBug12v32_DR12P_8MHz s29 located in the folder named D Bug12_Monitor for downloading You should see the following on the screen kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk 4 It will take 3 minutes to program the D Bug12 at 9600 baud rate and the bootloader menu will reappear after the D Bug12 monitor is successfully programmed into flash memory 3 2 Making a simple assembly program in RAM We are using AsmIDE as a terminal program and the following instructions to create your first assembly program If you are using a different terminal program the instructions may vary The steps to create your first program are as follows 1 Click the File button to open a new file In assembly language you specify the starting address of your CODE by an ORG statement You can start the data RAM at address 1000 with the statement org 1000 followed
54. shown on the digit 0 the rightmost digit but other 3 digits are turned off 8 Delay ims 9 Go back to step 1 25 4 4 Keypad Port A is an 8 bit bi directional port Its primary usage is for a 4X4 keypad If the port is not used for the keypad it can be used as a general purpose I O The schematic for the keypad connections is shown below PAO PA1 PA2 PA3 Col_0 Col_1 Col_2 Col_3 P57 PAS P amp G __PA3X KEY1 KEY2 KEYS P61 PAG PA4 Row_0 O O q O O KEYS KEYS KEY 4 O O q O 9 O O Paz PASE PAS Row_1 KEYS KEY1 KEY11 d O O q O q O Q P63 PAG PA6 Row_2 KEY13 KEY14 KEY15 O O O P4 PATK PA7 Row_3 KEYPAD Keypad connections PAO connects COLO of the keypad PA1 connects COL1 of the keypad PA2 connects COL2 of the keypad PA3 connects COL3 of the keypad PA4 connects ROWO of the keypad PA5 connects ROW1 of the keypad PA6 connects ROW2 of the keypad PA7 connects ROW3 of the keypad Keypad scan routine sets PA3 low and PAO PA1 PA2 high then tests PA4 PA7 If no key is down PA4 PA7 remain high If PA7 low the key 15 is down If PA6 low the key 14 is down If PA5 low the key 13 is down If PA4 low the key 12 is down Keypad scan routine sets PA2 low and PAO PA1 PAS high then tests PA4 PA7 If no key is down PA4 PA7 remain high If PA7 low the key 11 is down If PA6 low the key 10 is down If PA5 low the key 9 is down If PA4 low the key 8 is down Keypad scan rout
55. t if developing code in normal single chip mode Mode A select a solder bridge on solder side it defaults at 0 Do not change it if developing code in normal single chip mode Mode C select a solder bridge on solder side it defaults at 1 Do not change it if developing code in normal single chip mode Input voltage select for the 3 3V regulator U16 LM117 It s set for the on board unregulated 9V VIN Connects PE2 to relay circuit It s hardwired Servo motor power select The jumper is placed in the left position if servos are powered by the on board VCC 5V The jumper is placed in the right position if servos are powered by an external 5V power supply at the terminal block T7 X Y X Accelerometer module interface or IR distance sensor GP2D12 interface Bypasses low pass filter of RF receiver It s not connected 31 Chapter 5 EmbeddedGNU Eric Engler has published the EmbeddedGNU IDE that supports GNU C compiler and assembler for any 68HC11 HC12 HCS12 boards including our FOX11 EVBplus2 DRAGON12 and MiniDragon boards It s free software under Open Source GNU GPL License It s not freeware nor shareware be aware that some freeware are not free To download Eric s free tools including the GNU C compiler and assembler please visit his web site at http Avww geocities com englere_geo For your convenience we downloaded the egnu094 zip for you The following page shows the exact terms of the license Mozilla
56. t on the state of the ROMHM bit 16K Page Window 16 x 16K Flash EEPROM pages 16K Fixed Flash Page 3F 63 BDM if active Single wire Background ei Module Clock and Reset Generation Module CPU12 PE2 oo parse System Enhanced Capture PES ali H Les Integration Timer PE4 m E S MIM PES a SIM PES we PET ER TEST Petter et CITT Multiplexed Address Data Bus titit fttit PTB BDLC AXB J1850 TX8 AXCAN CANO TXAN AXCAN TXCAN AXCAN wc gt PBI ADDRO PBO CANI CAN2 ADDR15 PAT ADDR14 PAG ADDR13 PAS ADDR12 PA4 oe ADDR11 PAS a ADDR10 PA2 ADDRS PAI e ADDR amp PAO ADDR PB ADDR PDG ss ADDRS PBS ee ADDR4 PB4 at ADDR3 PBS ADDR2 PB2 e ADDR1 Module to Port Routing DATA15 DATA14 DATA 13 DATA 12 DATA11 DATA10 DATAS DATAS Intemal Logic 2 5V VO Driver 5V VOD 3 VDDX VSS1 2 VSSX se A D Converter 5V A Voltage Regulator Reference VDDA VSSA d PLL 2 5V VDDPLL VSSPLL n Voltage Regulator 5V A VO VODA zesce VSSR St Fig 1 2 MC9S12DG256 MCU block diagram VRH s VAL 2 VDDA VSSA t PADOS s PADO9 PAD10 PAD11 t PAD12 s PAD13 PAD14 PAD15 PK1 XADDR15 PK2 XADDR16 PK3 XADDRI7 PK4 XADDR18 PK5 1 XADDR19 PTO PTt PT2 PT3 PT4 PT5 PT6 PT7 PSO we PSI reg pS jae P5
57. tion Press OK to continue 5 COM Port Selection It asks if you want to select your COM port Say Yes Select your port in the dropdown box It defaults to 9600 baud which is normally correct Now press OK 6 Select Option gt Environment Options gt AutoDownload then disable ALL automatic commands 7 The current egnu094 zip is properly set up with the newest release version 3 1 GCC 3 3 6 In the future when upgrading to a newer version you have to update the linker s search directory See help file related version upgrade issues 32 Hardware Profile Profile Settings Profile Name Dragoni 2 MPU type C 68hc11 68hc12 and 3512 SRecCyt for 9s12 MPU binload for 9512C32 Serial Monitor Startup Code I Vibe baie eet deaminase This option lets you download 12 files using z Karl Lunt s binload program This will perform the COM Port for binload fi download when you press the Download Icon This only works with the 9s12C32 MPU Linker Script Options for Memory Map Linker Seach Directory Ic Susrlib gec lib 4m681 1 elf 3 3 6 m68he1 x 200601 22 mshort Enter Hex numbers here Origin Length 68hc11e20 ioports 0000 400 Check this box to have EmbeddedGNU run the objalloc utility in the make process Target the E20 Click here to fill in the values to the left Map for 68he11e20 eeprom DI cO data 1000 text 2000 vectors stack 2000 User Defined Entry option
58. umber that AsmIDE is going to use In order to find the USB to Serial COM port number you can click through control panel gt systems gt hardware gt device manager gt ports the USB to Serial COM port number will appear In Windows Vista you left click on Start right click on Computer left click on propriety then Device Manager and then Continue For setting the COM port of the AsmIDE to match that USB to Serial COM port number you can click through View gt Option gt Terminal Window Options menu then select the correct COM port from COM1 to COM8 Also set the COM port options at 9600 N 8 1 and check the enable the terminal window box After reset the D Bug12 monitor defaults baud rate at 9600 and and Hyperbaud function is disabled If Hyperbaud function is enabled the Hyperbaud toolbar button sends the BAUD 57600 command to the D Bug12 monitor and then it also changes the serial port to the 57600 baud rate IMPORTANT When you reset your board it will go back to 9600 baud and you will see characters aaaaaaaaaa on the screen You will need to press the Hyperbaud button once to return AsmIDE to 9600 baud and press it again to get 57600 baud To stay at the 57600 baud all the time you need to press the Hyperbaud button twice after every reset The Hyperbaud function is disabled by default and it should only be used by an experienced user not a beginner You can program text values for function keys to be se
59. ved to different addresses in D Bug12 V4 x The address for the printf is EE88 and addresses of other I O routines are listed below Function far main Start of D Bug12 SE getchar Geta character from SCIO or SCIL Checks for membership in the set 0 9 a f A F _ Converts lower case characters to upper case istrlen Returns the length of a null terminated string strepy EEN Copies a null terminated string Displays 8 bit number as 2 ASCII hex characters Disp SetUserVector Setup user interrupt service routine S Ge j far WriteEEByte Write a data byte to on chip BEPROM SEAS ReadMem Read data from the M68HC12 memory map WriteMem Write data to the M68HC12 memory map Fig 8 1 D Bug12 utility routines 36 8 2 Interrupt vector table Table 5 1 Interrupt Vector Locations Vector Address Interrupt Source FFFE FFFF Reset FFFC FFFD Clock Monitor fail reset FFFA FFFB COP failure reset FFF8 FFF9 Unimplemented instruction trap FFF6 FFF7 SWI FFF4 FFF5 XIRQ FFF2 FFF3 IRQ FFFO FFF1 Real Time Interrupt FFEE FFEF Enhanced Capture Timer channel 0 FFEC FFED Enhanced Capture Timer channel 1 FFEA FFEB Enhanced Capture Timer channel 2 HPRIO Value Local Enable to Elevate PLLCTL CME SCME COP rate select None CRGINT RTIE TIE
60. was aborted then you may need to reset the board before downloading a new application program The reset action will disable the interrupt that was enabled by the previous application If the interrupt was caused by a timer and is not disabled the timer interrupt will continue even it s not called for in your new application program The result will be unpredictable 3 In EVB mode reset clears your pseudo RAM interrupt vectors When you develop code with interrupts in RAM you must initialize pseudo RAM interrupt vectors in the very beginning of your program because if you press the reset button it will clear all pseudo RAM interrupt vectors If you don t initialize pseudo RAM interrupt vectors in your program and your application program uses interrupts your program may not run correctly since the interrupt vectors do not exist 4 Operating mode changing is only effective after reset There are four operating modes that are selected by SW7 The mode change won t be effective until you reset the board So you must always press the reset button after a mode change 41 8 5 Revision History Date Rev Notes 04 18 07 A Prototype 06 30 07 B First batch of production boards 1 The external resistor network RN12 for port A on the original Dragon12 board is eliminated on the new Dragon12 plus board In order for keypad routine to work with the new Dragon12 Plus board the internal pull up resistor
61. yboard You cannot go to the next step until PC screen shows the prompt s gt In order to program the flash memory you have to erase it by using the FBULK command S gt fbulk lt Enter gt S gt When the prompt s gt returns the FBULK command has already erased all of the flash memory contents of the target MC9S12DG256 including the bootloader If it returns with a message Flash or EEPROM Failed To Erase the MC9S12DG256 is defective Now we are going to program the bootloader and the D Bug12 into the flash memory of the target MC9S12DG256 Before we actually program the flash memory we must understand there are two different types of s record file that can be generated by compilers and assemblers An s1 record uses a 16 bit starting address field while an s2 record uses a 24 bit starting address field 17 An s1 record file looks like this S123FFA0F64CF650F654F658F65CF660F664F668F66CF670F674F678F67CF680F684F6883D S123FFCOF68CF690F 694F 698F 6 9CF 6A0F 6A4F 6A8F 6OACF 6BOF 6B4F 6B8F 6BCF 6COF 6C4F 6C81D S123FF EOF 6OCCF 6DOF 6D4F 6D8F 6DCF 6EOF 6E4F 6E8F OECF 6F OF GE 4F 6F 8F 6OFCF700F704F00009 S9030000FC An s2 record file looks like this S22 40FEFAODB70DB66DB5CDB52DB4 8DB3EDB3 4DB2ADB2 0DB1 6DBOCDBO0 2DAF 8DAEEDAE4DADA41 S22 40FEFCODADODAC 6DABCDAB2DAA8DA9EDA9 4DA8ADA8 0DA7 6DA6CDDD0ODA62DA5 8DA4EDA4 4 94 S2240FEFEODAO DAOADA12DA1ADA22DA2A

Download Pdf Manuals

image

Related Search

Related Contents

MI_CPM_Manuale installazione_1412BPS  LE CHUT de/par Nathalie TARLET et par Daniel PABŒUF  Smeg FI167STB Instructions for Use  Impiego - Wacker Neuson  Agilent SH-112 Dry Scroll Pump Instruction Manual  StarTech.com 36in SATA to Right Angle SATA Serial ATA Cable  Arc Flash Time Delay CSR  manuel d`installation et de mise en service  強震計観測施設(11)保守点検・修理業務 仕様書  USER MANUAL  

Copyright © All rights reserved.
Failed to retrieve file