Hallo allemaal,

Ik ben bezig om een lijnsensor (tsl1401 http://www.w-r-e.de/robotik/data/tsl1401.pdf) op een mbed aan te sluiten.
Ik heb de volgende software geschreven:


#include "uart/uart.h"
#include "lpc_adc.h"
#include "stdio.h"

#include "lpc17xx_clkpwr.h"
#include "lpc17xx_timer.h"
#include "lpc17xx_nvic.h"

#define p5			((uint32_t)0<<9)
#define p6			((uint32_t)0<<8)
#define p7			((uint32_t)0<<7)
#define p8			((uint32_t)0<<6)
#define p9			((uint32_t)0<<0)
#define p10			((uint32_t)0<<1)
#define p11			((uint32_t)0<<18)
#define p12			((uint32_t)0<<17)
#define p13			((uint32_t)0<<15)
#define p14			((uint32_t)0<<16)
#define p15			((uint32_t)0<<23)
#define p16			((uint32_t)0<<24)
#define p17			((uint32_t)0<<25)
#define p18			((uint32_t)0<<26)
#define p19			((uint32_t)1<<30)
#define p20			((uint32_t)1<<31)
#define p21			((uint32_t)2<<5)
#define p22			((uint32_t)2<<4)
#define p23			((uint32_t)2<<3)
#define p24			((uint32_t)2<<2)
#define p25			((uint32_t)2<<1)
#define p26			((uint32_t)2<<0)
#define p27			((uint32_t)0<<11)
#define p28			((uint32_t)0<<10)
#define p29			((uint32_t)0<<5)
#define p30			((uint32_t)0<<4)


COX_ADC_PI *adc = &pi_adc;




char *itoa(int value)  {
	static char buffer[12];        // 12 bytes is big enough for an INT32
	int original = value;        // save original value
	int c = sizeof(buffer)-1;
	buffer[c] = 0;                // write trailing null in last byte of buffer
	if (value < 0)                 // if it's negative, note that and take the absolute value
		value = -value;
	do                             // write least significant digit of value that's left
	{
		buffer[--c] = (value % 10) + '0';
	        value /= 10;
	}
	while (value);
	if (original < 0)
		buffer[--c] = '-';
	return &buffer[c];
}

int iOn =0;
int iWait = 80;
int itimes = 0;

int iValue[130];
void TIMER0_IRQHandler (void)
{
	// Clear Interrupt
	TIM_ClearIntPending(TIM0,TIM_MR0_INT);
	//code...



	if (itimes == 0){

		//GPIO_ClearValue(1,p20);
	}
	if (iOn == 0){
		iOn = 1;
		GPIO_SetValue(1,p19);
		//adc value ophalen
		//iValue[itimes] = adc->Read(LPC_ADC_CHANNEL2);
		itimes++;
	}
	else {
		iOn = 0;
		GPIO_ClearValue(1,p20);
		GPIO_ClearValue(1,p19);

		if (itimes == 256){
			GPIO_SetValue(1,p20);
			itimes = 0;
		}
	}
	return;
}

void Timer0_init()
{
	TIM_TIMERCFG_Type TMR0_Cfg;
	TIM_MATCHCFG_Type TMR0_Match;

	// On reset, Timer0/1 are enabled (PCTIM0/1 = 1), and Timer2/3 are disabled (PCTIM2/3 = 0).
	// Initialize timer 0, prescale count time of 100uS
	TMR0_Cfg.PrescaleOption = TIM_PRESCALE_USVAL;
	TMR0_Cfg.PrescaleValue = 50; //100
	// Use channel 0, MR0
	TMR0_Match.MatchChannel = 0;
	// Enable interrupt when MR0 matches the value in TC register
	TMR0_Match.IntOnMatch = ENABLE;
	//Enable reset on MR0: TIMER will reset if MR0 matches it
	TMR0_Match.ResetOnMatch = TRUE;
	//Don't stop on MR0 if MR0 matches it
	TMR0_Match.StopOnMatch = FALSE;
	// Do nothing for external output pin if match (see cmsis help, there are another options)
	TMR0_Match.ExtMatchOutputType = TIM_EXTMATCH_NOTHING;
	// Set Match value, count value of 10000 (10000 * 100uS = 1000000us = 1s --> 1 Hz)
	TMR0_Match.MatchValue = 1;//10000
	// Set configuration for Tim_config and Tim_MatchConfig
	TIM_Init(TIM0, TIM_TIMER_MODE, &TMR0_Cfg);
	TIM_ConfigMatch(TIM0, &TMR0_Match);

	// Preemption = 1, sub-priority = 1 //
	NVIC_SetPriority(TIMER0_IRQn, ((0x01<<3)|0x01));
	// Enable interrupt for timer 0 //
	NVIC_EnableIRQ(TIMER0_IRQn);
	// Start timer 0
	TIM_Cmd(TIM0, ENABLE);
}


int main(void)
{
	SystemInit();
	UART_0_Init();

	adc->Init(10000);

	CLKPWR_ConfigPPWR(CLKPWR_PCONP_PCGPIO, ENABLE);
	GPIO_SetDir(1, p19, 1);
	GPIO_SetDir(1, p20, 1);
	GPIO_ClearValue(1,p20);
	GPIO_ClearValue(1,p19);

	Timer0_init();

    while(1)
    {

    }
}

Op de osciloscoop zie ik het volgende:
http://img29.imageshack.us/g/f0001tek.jpg/

De blauwe lijn is de clock, de paarse is de SI en de gele is de ao.
Het probleem is nu dat ik dus geen enkel signaal krijg op de ao. ik verwacht hier eigelijk een analoog signaal. Weet iemand wat ik verkeerd doe?