/*
* Created on 26 de julio de 2013, 03:40 PM
*/
#include <p18CXXX.h>
#include <xc.h>
#include "AES.h"
#include "usart.h"
#include <xc.h>
#include "config.h"
#include <plib/usart.h>
#define _XTAL_FREQ 8000000 //The speed of your internal(or)external oscillator
#define USE_AND_MASKS
// CONFIG1L
#pragma config WDTEN = ON // Watchdog Timer Enable bit (WDT enabled)
#pragma config STVREN = ON // Stack Overflow/Underflow Reset Enable bit (Reset on stack overflow/underflow enabled)
#pragma config XINST = OFF // Extended Instruction Set Enable bit (Instruction set extension and Indexed Addressing mode disabled (Legacy mode))
// CONFIG1H
#pragma config CP0 = OFF // Code Protection bit (Program memory is not code-protected)
// CONFIG2L
#pragma config FOSC = HS // Oscillator Selection bits (HS oscillator)
#pragma config FOSC2 = ON // Default/Reset System Clock Select bit (Clock selected by FOSC as system clock is enabled when OSCCON<1:0> = 00)
#pragma config FCMEN = ON // Fail-Safe Clock Monitor Enable bit (Fail-Safe Clock Monitor enabled)
#pragma config IESO = ON // Two-Speed Start-up (Internal/External Oscillator Switchover) Control bit (Two-Speed Start-up enabled)
// CONFIG2H
#pragma config WDTPS = 32768 // Watchdog Timer Postscale Select bits (1:32768)
// CONFIG3H
#pragma config CCP2MX = DEFAULT // CCP2 MUX bit (CCP2 is multiplexed with RC1)
/****************************** Constants ***************************/
const char ENCODE_KEY[]= {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F};
const char DECODE_KEY[]= {0x13,0x11,0x1D,0x7F,0xE3,0x94,0x4A,0x17,0xF3,0x07,0xA7,0x8B,0x4D,0x2B,0x30,0xC5};
void ConfIO( void );
unsigned char auxRecibido ;
void testAES( void );
void interrupt ISR( void );
void ConfIO( void );
unsigned char vector[32] ;
unsigned char vector2[16] ;
unsigned char i ;
void main(void) {
//TXSTA
BRGH = 0 ;
SYNC = 0 ;
//RCSTA
SPEN = 1 ; //Habilita el puerto serial
CREN = 1 ;
//BAUDCON
BRG16 = 0 ;
SPBRG = 15;
IPEN = 0 ; //Usa un sólo vector de interrupciones
PEIE = 1; //Enable pheripheral interrupt
GIEL = 1; //Habilita las interrupciones
GIE = 1; //re Habilita las interrupciones
GIEH = 1; //re re Habilita las interrupciones
RCIE = 0; //Enable RX interrupt
RCIP = 0; //high priority, sólo por probar
RCIF = 0; //reset RX pin flag
TRISCbits.TRISC6 = 0 ;
TRISCbits.TRISC7 = 1;
while (1) {
}
}
void interrupt High_ISR( void ) {
if ( RCIF ) {
vector[i] = RCREG;
i++;
if( i == 16 ) {
i=0;
LATBbits.LATB0 ^= 1; //toggle LED on RB0
}
}
EUART.rar_PIC EUSART_PIC18 EUART_XC8_eusart_xc8 pic
版权申诉
55 浏览量
2022-09-24
05:43:28
上传
评论
收藏 1KB RAR 举报
小波思基
- 粉丝: 72
- 资源: 1万+
最新资源
- 本科毕业设计基于C# wpf人脸识别的考勤系统的设计与实现源码.zip
- 基于Ruoyi+uniapp实现学生考勤系统 学生考勤源码+项目说明.zip
- feae6bc968ca68a099455d8b8a8dea35
- 基于Pytorch训练CIRAR10上分类算法.zip
- Pytorch-pytorch深度学习教程之Tensorboard.zip
- 基于C++和Python开发yolov8-face作为人脸检测器dlib作为人脸识别器的人脸考勤系统源码+项目说明.zip
- Pytorch-pytorch深度学习教程之变分自动编码器.zip
- Pytorch-pytorch深度学习教程之神经风格迁移.zip
- Pytorch-pytorch深度学习教程之深度残差网络.zip
- Pytorch-pytorch深度学习教程之循环神经网络.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈