久久久久久久999_99精品久久精品一区二区爱城_成人欧美一区二区三区在线播放_国产精品日本一区二区不卡视频_国产午夜视频_欧美精品在线观看免费
標題:
LPC1788 SPI主從機代碼
[打印本頁]
作者:
hadaxio
時間:
2018-12-6 13:19
標題:
LPC1788 SPI主從機代碼
在做LPC1788開發板的主從機開發,分享下代碼
0.png
(39 KB, 下載次數: 67)
下載附件
2018-12-6 17:33 上傳
單片機源程序如下:
/**********************************************************************
* $Id[ DISCUZ_CODE_1 ]nbsp; mcu_main_new.c 2012-05-04
*//**
* @file mcu_main_new.c
* @brief User program.
* @version 1.0
* @date 04. May. 2012
* @author NXP MCU SW Application Team
*
* Copyright(C) 2011, NXP Semiconductor
* All rights reserved.
*
***********************************************************************
* Software that is described herein is for illustrative purposes only
* which provides customers with programming information regarding the
* products. This software is supplied "AS IS" without any warranties.
* NXP Semiconductors assumes no responsibility or liability for the
* use of the software, conveys no license or title under any patent,
* copyright, or mask work right to the product. NXP Semiconductors
* reserves the right to make changes in the software without
* notification. NXP Semiconductors also make no representation or
* warranty that such application will be suitable for the specified
* use without further testing or modification.
* Permission to use, copy, modify, and distribute this software and its
* documentation is hereby granted, under NXP Semiconductors'
* relevant copyright in the software, without fee, provided that it
* is used in conjunction with NXP Semiconductors microcontrollers. This
* copyright, permission, and disclaimer notice must appear in all copies of
* this code.
**********************************************************************/
#include "includes.h"
#define VTOR_OFFSET (0x00001000)
SBL_FirmVerion_Type firm_vers __attribute__((section("firmware_id_section")))= {0,1,'b'};
/************************** PRIVATE DEFINITIONS *************************/
#ifdef __MCU_LPC17xx
#define MCB_1700
//#define IAR_LPC_1768
#elif defined (__MCU_LPC11xx)
#define MCB_1100
#endif
#if defined (MCB_1700)
/* Number of user LEDs */
#define LED_NUM 4
const unsigned long led_mask[] = { 1<<3, 1<<4, 1<<5, 1<<6 };
#elif defined(MCB_1100)
#define LED_NUM 4
const unsigned long led_pin[] = { 3, 4, 5, 6 };
#endif
/************************** PRIVATE VARIABLES *************************/
/* SysTick Counter */
volatile unsigned long SysTickCnt;
/************************** PRIVATE FUNCTIONS *************************/
void SysTick_Handler (void);
void ReAllocateNVIC(void);
/*----------------- INTERRUPT SERVICE ROUTINES --------------------------*/
/*********************************************************************//**
* @brief SysTick handler sub-routine (1ms)
* @param[in] None
* @return None
**********************************************************************/
void SysTick_Handler (void) {
SysTickCnt++;
}
/*-------------------------PRIVATE FUNCTIONS------------------------------*/
/*********************************************************************//**
* @brief Re-allocate vector interrupt table
* @param[in] None
* @return int
**********************************************************************/
void ReAllocateNVIC(void)
{
#ifdef __MCU_LPC17xx
__disable_irq();
NVIC_SetVTOR(VTOR_OFFSET);
__enable_irq();
#elif defined (__MCU_LPC11xx)
uint32_t* src,*dst;
int32_t size;
__disable_irq();
// copy vector table
src = (uint32_t*)VTOR_OFFSET;
dst = (uint32_t*)0x10000000;
size = 192;
while(size > 0)
{
*dst++ = *src++;
size -= 4;
}
LPC_SYSCON->SYSMEMREMAP = 0x1; /* remap to internal RAM */
__enable_irq();
#endif
}
/*-------------------------MAIN FUNCTION------------------------------*/
/*********************************************************************//**
* @brief c_entry: Main program body
* @param[in] None
* @return None
**********************************************************************/
void c_entry(void)
{
int num = 0;
uint32_t systickcnt;
SBL_SlaveInit();
/* Relocate NVIC */
ReAllocateNVIC();
SystemCoreClockUpdate();
SysTick_Config(SystemCoreClock/1000 - 1); /* Generate interrupt each 1 ms */
#if defined (MCB_1700)
GPIO_SetDir(2, 0x0000007C, 1); /* LEDs on PORT2 defined as Output */
GPIO_ClearValue(2, 0x0000007C);
#elif defined(MCB_1100)
for(num = LED_NUM-1;num>=0;num--)
{
GPIO_SetDir(2, led_pin[num],1);
GPIO_SetValue(2, led_pin[num]);
}
#elif defined(IAR_LPC_1768)
GPIO_SetDir(1, (1<<25), 1);
GPIO_ClearValue(1, (1<<25));
#endif
while(1)
{
if(SBL_SlaveCmdRecv())
{
SBL_SlaveCmdHandler(SBL_SlaveGetRecvCmd());
}
else
{
if(((SysTickCnt - systickcnt) < 500))
{
#if defined (MCB_1700)
for(num = LED_NUM-1;num>=0;num--)
GPIO_SetValue(2, led_mask[num]);
#elif defined(MCB_1100)
for(num = LED_NUM-1;num>=0;num--)
GPIO_SetValue(2, led_pin[num]);
#else
GPIO_SetValue(2,(1<<25));
#endif
}
else if(((SysTickCnt - systickcnt) < 1000))
{
#ifdef MCB_1700
for(num = LED_NUM-1;num>=0;num--)
GPIO_ClearValue(2, led_mask[num]);
#elif defined(MCB_1100)
for(num = LED_NUM-1;num>=0;num--)
GPIO_ClearValue(2, led_pin[num]);
#else
GPIO_ClearValue(1,(1<<25));
#endif
}
else
{
systickcnt = SysTickCnt;
}
}
}
//SBL_DeInit();
}
/* With ARM and GHS toolsets, the entry point is main() - this will
allow the linker to generate wrapper code to setup stacks, allocate
heap area, and initialize and copy code and data segments. For GNU
toolsets, the entry point is through __start() in the crt0_gnu.asm
file, and that startup code will setup stacks and data */
int main(void)
{
c_entry();
return 0;
}
復制代碼
所有資料51hei提供下載:
AN11257.zip
(637.92 KB, 下載次數: 11)
2018-12-6 13:19 上傳
點擊文件名下載附件
下載積分: 黑幣 -5
作者:
yb1988001
時間:
2018-12-10 14:14
多謝樓主分享資料
歡迎光臨 (http://www.zg4o1577.cn/bbs/)
Powered by Discuz! X3.1
主站蜘蛛池模板:
涩涩片影院
|
国产国产精品久久久久
|
水蜜桃久久夜色精品一区
|
成人精品在线观看
|
国产91av视频
|
网络毛片
|
欧美日韩在线看
|
成人在线黄色
|
欧美精品成人一区二区三区四区
|
国产精品99久久久久久宅男
|
国产精品日韩在线观看一区二区
|
日韩精品一区二区三区在线播放
|
欧美激情一区二区
|
黄色福利
|
久久精品国产一区二区
|
av乱码
|
国产精品免费观看
|
一区亚洲
|
99精品视频一区二区三区
|
97超碰在线免费
|
又爽又黄axxx片免费观看
|
三级黄片毛片
|
亚洲精品福利在线
|
精品欧美一区二区精品久久久
|
99婷婷
|
日韩精品免费播放
|
久久毛片
|
蜜桃视频麻豆
|
精品一二区
|
久久午夜视频
|
久久久夜
|
精品一区二区三区入口
|
精品视频久久久
|
成人午夜网站
|
精品网站999
|
亚洲国产一区二区三区
|
成人性视频免费网站
|
这里只有精品99re
|
免费在线观看h片
|
午夜精品一区二区三区在线
|
午夜精品一区二区三区在线观看
|