Hi, 1. I would like to drive a standard 20x2 LCD in 4 bit mode using the DSK (obviously as part of a greater project). I want to use the expansion peripheral interface for this purpose, using some of the MCBSP pins. As a test program, I am trying to turn the LEDs on and off without using the board.h functions brd_led_*(). As I understand it, I should be able to access the LEDs using the CNTL1 register. How can I set and clear each LED individually? That is, what C function or ASM mnemonic can I use to achieve "SETBIT" CNTL1, USERLED2 or "CLRBIT" CNTL1, USERLED2 2. Can someone please explain what "wait states" are? I wouldn't dare ask these questions in comp.dsp, and I hope that you guys will be tolerant of them. If these questions are answered in any FAQ or other reference, please point me in the right direction. Thanks in advance, Johan KOHLER |
|
5402/DSK5416 Basics
Started by ●September 23, 2003
Reply by ●September 24, 20032003-09-24
reebil wrote: > Hi, > 1. I would like to drive a standard 20x2 LCD in 4 bit mode using the > DSK (obviously as part of a greater project). I want to use the > expansion peripheral interface for this purpose, using some of the > MCBSP pins. As a test program, I am trying to turn the LEDs on and > off without using the board.h functions brd_led_*(). As I understand > it, I should be able to access the LEDs using the CNTL1 register. > > How can I set and clear each LED individually? That is, what C > function or ASM mnemonic can I use to achieve > "SETBIT" CNTL1, USERLED2 or > "CLRBIT" CNTL1, USERLED2 > I don't use the DSK so I don't know what API calls to use. But to control the McBSP lines when the McBSP is disabled (of course) you use the bits in the PCR register associated with the McBSP. > 2. Can someone please explain what "wait states" are? > Wait states are delays that are inserted when accessing external memory like flash or external ram. The DSP runs so fast that no external flash can keep up with it running at 100MHz, so you setup the wait-state register to slow down external memory requests so that they don't exceed the speed rating of the flash (or other external memory mapped device). > I wouldn't dare ask these questions in comp.dsp, and I hope that you > guys will be tolerant of them. If these questions are answered in any > FAQ or other reference, please point me in the right direction. > Oh My! Be tolerant of questions!? Never! What kind of place do you think this is? Do you think we all just sit here waiting to jump at your beck and call? We certainly have better issues to discuss than your insignificant little problems; we have code to write, products to design, people to flame! Why I ought to just ... Oh, sorry, I forgot that this wasn't comp.dsp <G>. Welcome to the list, you'll find things a bit more relaxed here. Brian |
|
Reply by ●September 29, 20032003-09-29
Hi, Just to give some feedback, here is my original question: > > How can I set and clear each LED individually? That is, what C > > function or ASM mnemonic can I use to achieve > > "SETBIT" CNTL1, USERLED2 or > > "CLRBIT" CNTL1, USERLED2 I found that there are some macros (eg. SET_REG_BIT, RESET_REG_BIT) defined in regs54xx.h which show how to address the bits using a bit mask and AND or OR. It is not possible to set a bit directly as with some microcontrollers (eg. AVR has BCF and BSF (bit clear and bit set respectively) - you have to operate on the entire register. I also saw that the CPLD registers are accessible as predefined i/o ports (port0 through port7). These are defined in board.h . So I can make the led blink as follows: while (1) { SET_REG_BIT(port0, 0) /* turn LED0 on */ brd_delay_msec(500) /* delay 1/2 sec */ RESET_REG_BIT(port0, 0) /* turn LED0 off */ brd_delay_msec(500) /* delay 1/2 sec */ } Thanks to all who responded. -- Johan |