Content originally posted in LPCWare by gnotari on Thu Jul 01 08:34:34 MST 2010
Hi guys,
I testet it on LPC 1114 Xpressoboard. The following code worked fine:
[LEFT][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]// [U]Init[/U][/COLOR][/SIZE][/COLOR][/SIZE][/LEFT]
[SIZE=2]LPC_SYSCON->[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]SYSAHBCLKCTRL[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] |= (1<<6); [/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]// Enable GPIO [U]clk[/U][/COLOR][/SIZE][/COLOR][/SIZE]
[SIZE=2]LPC_IOCON->[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]PIO0_1[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] &= ~0x3F; [/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]// Select [U]clkout[/U] function for P0.1[/COLOR][/SIZE][/COLOR][/SIZE]
[LEFT][SIZE=2]LPC_IOCON->[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]PIO0_1[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] |= 0x01;[/SIZE][/LEFT]
[SIZE=2]LPC_SYSCON->[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]CLKOUTCLKSEL[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] = 0x03; [/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]// IRC: 0x00 System [U]osci[/U]: 0x01 WTD: 0x02 Main [U]clk[/U]: 0x03[/COLOR][/SIZE][/COLOR][/SIZE]
[LEFT][SIZE=2]LPC_SYSCON->[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]CLKOUTUEN[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] = 0x01; [/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]// Update clock[/COLOR][/SIZE][/COLOR][/SIZE][/LEFT]
[SIZE=2]LPC_SYSCON->[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]CLKOUTUEN[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] = 0x00; [/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]// Toggle update register once[/COLOR][/SIZE][/COLOR][/SIZE]
[SIZE=2]LPC_SYSCON->[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]CLKOUTUEN[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] = 0x01;[/SIZE]
[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]while[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] ( !(LPC_SYSCON->[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]CLKOUTUEN[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] & 0x01) ); [/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]// Wait until updated[/COLOR][/SIZE][/COLOR][/SIZE]
[LEFT][SIZE=2]LPC_SYSCON->[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]CLKOUTDIV[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] = 1; [/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]// Divided by 1[/COLOR][/SIZE][/COLOR][/SIZE][/LEFT]
[LEFT]Have fun![/LEFT]
[LEFT]Greetings, [/LEFT]
[LEFT]Gianni[/LEFT]