📄 timer1.c
字号:
/****************************************************************************
*
* MODULE: Timer1.c
*
* COMPONENT: $RCSfile: $
*
* VERSION: $Name: $
*
* REVISION: $Revision: $
*
* DATED: $Date: 30/06/06 $
*
* STATUS: $State: $
*
* AUTHOR: Gordon MacNee
*
* DESCRIPTION
* code segment to demonstrate the operation of the timers
* running in two modes of PWM
* no interrupts are used in these routines
*
* CHANGE HISTORY:
*
* $Log: $
*
*
* LAST MODIFIED BY: $Author: pc1 $
* $Modtime: $
*
*
****************************************************************************
* This software is owned by Jennic and/or its supplier and is protected
* under applicable copyright laws. All rights are reserved. We grant you,
* and any third parties, a license to use this software solely and
* exclusively on Jennic products. You, and any third parties must
* reproduce the copyright and warranty notice and any other legend of
* ownership on each copy or partial copy of the software.
*
* THIS SOFTWARE IS PROVIDED 揂S IS? JENNIC MAKES NO WARRANTIES, WHETHER
* EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE,
* ACCURACY OR LACK OF NEGLIGENCE. JENNIC SHALL NOT, IN ANY CIRCUMSTANCES,
* BE LIABLE FOR ANY DAMAGES, INCLUDING, BUT NOT LIMITED TO, SPECIAL,
* INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON WHATSOEVER.
*
* Copyright Jennic Ltd 2005, 2006. All rights reserved
*
****************************************************************************/
/****************************************************************************/
/*** Include files ***/
/****************************************************************************/
#include <jendefs.h>
#include <AppHardwareApi.h>
/****************************************************************************/
/*** Macro Definitions ***/
/****************************************************************************/
/****************************************************************************/
/*** Type Definitions ***/
/****************************************************************************/
/****************************************************************************/
/*** Local Function Prototypes ***/
/****************************************************************************/
/****************************************************************************/
/*** Exported Variables ***/
/****************************************************************************/
/****************************************************************************/
/*** Local Variables ***/
/****************************************************************************/
/****************************************************************************/
/*** Exported Functions ***/
/****************************************************************************/
/****************************************************************************/
/*** Local Functions ***/
/****************************************************************************/
PRIVATE void vProcessEventQueues(void);
PRIVATE void sent_uart0();
/****************************************************************************
*
* NAME: vTimerConfig
*
* DESCRIPTION:
* PWM output from timer0 in Delta Sigma mode
* with a low period of 0x8000 and a high of (0xffff - 0x8000)
*
* PWM output from timer1 in standard PWM mode
* with a low period of 0x8000 and a high of (0xffff - 0x8000)
*
* PARAMETERS: Name RW Usage
* None.
*
* RETURNS:
* None.
*
* NOTES:
* In this mode the period of timer0 is fixed
* at 2^16 or 2^17 and the u16Lo the SPACE period
****************************************************************************/
PRIVATE void sent_uart0( )
{
/* Set up uart0 */
vAHI_UartEnable(E_AHI_UART_0);
/* Reset the Tx and Rx */
vAHI_UartReset(E_AHI_UART_0, E_AHI_UART_TX_RESET, E_AHI_UART_RX_RESET);
/* set baud rate */
vAHI_UartSetClockDivisor(0, E_AHI_UART_RATE_38400);
/* set parity, start bits, number data bits */
vAHI_UartSetControl(E_AHI_UART_0,
E_AHI_UART_EVEN_PARITY,
E_AHI_UART_PARITY_DISABLE,
E_AHI_UART_WORD_LEN_8,
E_AHI_UART_1_STOP_BIT,
E_AHI_UART_RTS_HIGH);
/* clear reset */
vAHI_UartReset(E_AHI_UART_0, E_AHI_UART_TX_ENABLE, E_AHI_UART_RX_ENABLE);
/* output message */
char acstring[] = “Hello World”;
char *pcstring = acstring;
while (*pcstring)
{
vAHI_UartWriteData(E_AHI_UART_0, *pcstring);
pcstring++;
}
}
/****************************************************************************
*
* NAME: AppColdStart
*
* DESCRIPTION:
*
* PARAMETERS: Name RW Usage
* None.
*
* RETURNS:
* None.
*
* NOTES:
* Entry point for a power on reset or wake from sleep mode.
****************************************************************************/
PUBLIC void AppColdStart(void)
{
/* Initialise stack and hardware interfaces. */
(void)u32AHI_Init();
/* configure and start timer 0 and 1 running different PWM types */
void sent_uart0();
/* just sit in this loop and let the hardware run the PWM */
while(1)
{
}
}
/****************************************************************************
*
* NAME: AppWarmStart
*
* DESCRIPTION:
* Entry point for a wake from sleep mode with the memory contents held. We
* are not using this mode and so should never get here.
*
* PARAMETERS: Name RW Usage
* None.
*
* RETURNS:
* None.
*
* NOTES:
* None.
****************************************************************************/
PUBLIC void AppWarmStart(void)
{
AppColdStart();
}
/****************************************************************************/
/*** END OF FILE ***/
/****************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -