Prev: Heat dissip. series vs. parallel
Next: see URL:
From: Phil Hobbs on 1 Apr 2010 13:20 On 4/1/2010 1:05 PM, linnix wrote: > On Apr 1, 6:23 am, Phil Hobbs<pcdhSpamMeSensel...(a)electrooptical.net> > wrote: >> I got one of those NXP LPCXpresso boards with a Cortex M3 ARM on it, >> installed the dev tools, and whadda ya know, the demo using the >> semihosting thing works OK, for printf("Hello, World!") at least. > > If you have "Hello, World", then everything is already setup for the > boot code. > >> >> Sooo, now the problem is porting a bunch of fairly simple PIC code over >> to the ARM, for controlling RC servos etc. Not too radical a job, >> _except_ that, as always with a new micro, more than half the work is >> getting the peripheral control registers set up right. > > What else do you need to setup, except for I/Os? For example (for > Keil): > > GPIODirModeSet(GPIO_PORTB_BASE, GPIO_PIN_1, GPIO_DIR_MODE_IN); > GPIOPinRead(GPIO_PORTB_BASE, GPIO_PIN_1); > GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_1, 0); > PWMs, captures, ADC, DAC, motor control,... I usually suck down the manual and write a well-commented single function that sets all of them and discusses just what each bit is for. This manual is almost 900 pages, and I don't want to spend that amount of time if I can help it. Cheers Phil Hobbs -- Dr Philip C D Hobbs Principal ElectroOptical Innovations 55 Orchard Rd Briarcliff Manor NY 10510 845-480-2058 hobbs at electrooptical dot net http://electrooptical.net
From: linnix on 1 Apr 2010 13:46 On Apr 1, 9:20 am, Phil Hobbs <pcdhSpamMeSensel...(a)electrooptical.net> wrote: > On 4/1/2010 1:05 PM, linnix wrote: > > > > > On Apr 1, 6:23 am, Phil Hobbs<pcdhSpamMeSensel...(a)electrooptical.net> > > wrote: > >> I got one of those NXP LPCXpresso boards with a Cortex M3 ARM on it, > >> installed the dev tools, and whadda ya know, the demo using the > >> semihosting thing works OK, for printf("Hello, World!") at least. > > > If you have "Hello, World", then everything is already setup for the > > boot code. > > >> Sooo, now the problem is porting a bunch of fairly simple PIC code over > >> to the ARM, for controlling RC servos etc. Not too radical a job, > >> _except_ that, as always with a new micro, more than half the work is > >> getting the peripheral control registers set up right. > > > What else do you need to setup, except for I/Os? For example (for > > Keil): > > > GPIODirModeSet(GPIO_PORTB_BASE, GPIO_PIN_1, GPIO_DIR_MODE_IN); > > GPIOPinRead(GPIO_PORTB_BASE, GPIO_PIN_1); > > GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_1, 0); > > PWMs, captures, ADC, DAC, motor control,... I can post codes for PWM and ADC. LPC11XX does not have DAC.
From: D Yuniskis on 1 Apr 2010 15:11 Hi Phil, Phil Hobbs wrote: > On 4/1/2010 1:05 PM, linnix wrote: >> On Apr 1, 6:23 am, Phil Hobbs<pcdhSpamMeSensel...(a)electrooptical.net> >> wrote: >>> I got one of those NXP LPCXpresso boards with a Cortex M3 ARM on it, >>> installed the dev tools, and whadda ya know, the demo using the >>> semihosting thing works OK, for printf("Hello, World!") at least. >> >> If you have "Hello, World", then everything is already setup for the >> boot code. >> >>> >>> Sooo, now the problem is porting a bunch of fairly simple PIC code over >>> to the ARM, for controlling RC servos etc. Not too radical a job, >>> _except_ that, as always with a new micro, more than half the work is >>> getting the peripheral control registers set up right. >> >> What else do you need to setup, except for I/Os? For example (for >> Keil): >> >> GPIODirModeSet(GPIO_PORTB_BASE, GPIO_PIN_1, GPIO_DIR_MODE_IN); >> GPIOPinRead(GPIO_PORTB_BASE, GPIO_PIN_1); >> GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_1, 0); >> > > PWMs, captures, ADC, DAC, motor control,... > > I usually suck down the manual and write a well-commented single > function that sets all of them and discusses just what each bit is for. > This manual is almost 900 pages, and I don't want to spend that amount > of time if I can help it. I usually go through the manual and write a routine that sets each "thing" to its default state. This serves several purposes. First, it gets me aware of what's inside the box. It makes me aware of how many of whatever. Second, it lets me see what capabilities each of those things has. And, exposes me to any restrictions on the uses of those capabilities (e.g., pin sharing, etc.). Third, it gives me a convenient place in my code to reference the "default conditions" for each of these devices. Saves a trip through the manual! Fourth, it gives me a starting point for the "my version" of this routine -- i.e., after everything is at its default state, now I need to bring these things to the state that *I* want them to be in for *this* application. Fifth, it gives me a convenient way to reset everything AS IF power had just been applied. This is often invaluable with devices that must run unattended "indefinitely" -- where you can't rely on a PoR (and don't want to risk a watchdog reset). Lately, as datasheets are getting *so* fat, I add crossreferences in the commentary pointing me to pages/sections in the datasheet (manual). I also paraphrase key restrictions on the initialization so I don't have to re-consult the datasheet (e.g., X must be initialized before Y *because*...)
From: Phil Hobbs on 1 Apr 2010 18:24 On 4/1/2010 1:46 PM, linnix wrote: > On Apr 1, 9:20 am, Phil Hobbs<pcdhSpamMeSensel...(a)electrooptical.net> > wrote: >> On 4/1/2010 1:05 PM, linnix wrote: >> >> >> >>> On Apr 1, 6:23 am, Phil Hobbs<pcdhSpamMeSensel...(a)electrooptical.net> >>> wrote: >>>> I got one of those NXP LPCXpresso boards with a Cortex M3 ARM on it, >>>> installed the dev tools, and whadda ya know, the demo using the >>>> semihosting thing works OK, for printf("Hello, World!") at least. >> >>> If you have "Hello, World", then everything is already setup for the >>> boot code. >> >>>> Sooo, now the problem is porting a bunch of fairly simple PIC code over >>>> to the ARM, for controlling RC servos etc. Not too radical a job, >>>> _except_ that, as always with a new micro, more than half the work is >>>> getting the peripheral control registers set up right. >> >>> What else do you need to setup, except for I/Os? For example (for >>> Keil): >> >>> GPIODirModeSet(GPIO_PORTB_BASE, GPIO_PIN_1, GPIO_DIR_MODE_IN); >>> GPIOPinRead(GPIO_PORTB_BASE, GPIO_PIN_1); >>> GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_1, 0); >> >> PWMs, captures, ADC, DAC, motor control,... > > I can post codes for PWM and ADC. LPC11XX does not have DAC. > Thanks! This one is the LPC1343 version, which does have a DAC. At the risk of some scorn and derision from Real Programmers, I'll post a link to the completed function when it's done. Cheers Phil Hobbs -- Dr Philip C D Hobbs Principal ElectroOptical Innovations 55 Orchard Rd Briarcliff Manor NY 10510 845-480-2058 hobbs at electrooptical dot net http://electrooptical.net
From: linnix on 1 Apr 2010 23:20
On Apr 1, 3:24 pm, Phil Hobbs <pcdhSpamMeSensel...(a)electrooptical.net> wrote: > On 4/1/2010 1:46 PM, linnix wrote: > > > > > On Apr 1, 9:20 am, Phil Hobbs<pcdhSpamMeSensel...(a)electrooptical.net> > > wrote: > >> On 4/1/2010 1:05 PM, linnix wrote: > > >>> On Apr 1, 6:23 am, Phil Hobbs<pcdhSpamMeSensel...(a)electrooptical.net> > >>> wrote: > >>>> I got one of those NXP LPCXpresso boards with a Cortex M3 ARM on it, > >>>> installed the dev tools, and whadda ya know, the demo using the > >>>> semihosting thing works OK, for printf("Hello, World!") at least. > > >>> If you have "Hello, World", then everything is already setup for the > >>> boot code. > > >>>> Sooo, now the problem is porting a bunch of fairly simple PIC code over > >>>> to the ARM, for controlling RC servos etc. Not too radical a job, > >>>> _except_ that, as always with a new micro, more than half the work is > >>>> getting the peripheral control registers set up right. > > >>> What else do you need to setup, except for I/Os? For example (for > >>> Keil): > > >>> GPIODirModeSet(GPIO_PORTB_BASE, GPIO_PIN_1, GPIO_DIR_MODE_IN); > >>> GPIOPinRead(GPIO_PORTB_BASE, GPIO_PIN_1); > >>> GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_1, 0); > > >> PWMs, captures, ADC, DAC, motor control,... > > > I can post codes for PWM and ADC. LPC11XX does not have DAC. > > Thanks! This one is the LPC1343 version, which does have a DAC. > I don't see the DAC, only 8 channels 10 bits ADC. http://ics.nxp.com/products/lpc1000/datasheet/lpc1311.lpc1313.lpc1342.lpc1343.pdf |