pic

What does __attribute__((__interrupt__, no_auto_psv)) do?

◇◆丶佛笑我妖孽 提交于 2021-02-06 06:30:21
问题 void __attribute__((__interrupt__, no_auto_psv)) _T1Interrupt(void) // 5 Hz __attribute__ directive or macro is from GCC but __interrupt__ and no_auto_psv is not , it's specific to a hardware. So, how does GCC Compiler understand __interrupt__ and no_auoto_psv , I searched and didn't find any declaration in anywhere else. So basically the _T1Interrupt function takes no argument and return nothing but has the above attribute? 回答1: In particular, these attributes are platform-specific

What does __attribute__((__interrupt__, no_auto_psv)) do?

落爺英雄遲暮 提交于 2021-02-06 06:28:01
问题 void __attribute__((__interrupt__, no_auto_psv)) _T1Interrupt(void) // 5 Hz __attribute__ directive or macro is from GCC but __interrupt__ and no_auto_psv is not , it's specific to a hardware. So, how does GCC Compiler understand __interrupt__ and no_auoto_psv , I searched and didn't find any declaration in anywhere else. So basically the _T1Interrupt function takes no argument and return nothing but has the above attribute? 回答1: In particular, these attributes are platform-specific

How can I exit my lookup table instruction with the desired value on PIC16F1829

不想你离开。 提交于 2021-01-29 08:19:34
问题 How can I get my code to work correctly when I include ADC conversion in it? I have a working code that displays two digits on 2 LED displays using a p16f1829. However, a problem arises when I try to include a code block that collects the results of an ADC conversion to display on the LED display (see below). A2D: ; Start the ADC NOP ; Requried ADC delay of 8uS => (1/(Fosc/4)) = (1/(500KHz/4)) = 8uS BANKSEL ADCON0 ; Selects memory bank containing ADCON0 register BSF ADCON0, GO ; Start the ADC

16PIC877A Reset with C code

夙愿已清 提交于 2021-01-29 03:06:14
问题 I am using PIC16F877a and I need program reset without using button. When I looked at datasheet and referance designs, there is a button on MLCR pin. If button was pushed, MCU was reset. But I need reset that can control with C code, I don't want to use reset button. Is there another way to do it? 回答1: PIC 8-bit MCUS have a software reset assembly instruction: RESET http://microchip.wikidot.com/8bit:rst You will have to use inline assembly. I've never used inline assembly for a PIC, but from

Issue in interfacing SPI e-ink display with PIC 18F46K22

不羁岁月 提交于 2021-01-28 04:48:30
问题 I am using a PIC 18F46K22 in SPI master mode to communicate with a Waveshare 1.54" ePaper Module. The FOSC frequency is 8Mhz internal and SPI configuration is FOSC/4. So when I check the output on logic-analyzer some output bits are differ from expected. And there is some deviation in SCL. #include <xc.h> #include "config.h" #include <stdbool.h> #include <stddef.h> #include <stdint.h> #include "main.h" //#define _XTAL_FREQ 8000000 #define SPI1_DUMMY_DATA 0x0 #define SPI_RX_IN_PROGRESS 0x0

基于PIC单片机的TC35 GSM使用心得

安稳与你 提交于 2020-12-18 08:57:20
近些天一直在研究XC-TC35 模块,此模块使用起来特别方便,只要熟悉一些AT指令及简单的单片机编程即可轻松使用 废话不多说,下面粘出我写的代码(基于PIC16F877A) 此程序可以实现用手机发送“开灯”或“关灯”,然后tc35会向手机返回“开灯”或“关灯” #include<pic.h> #include<string.h> #include"serial.h" __CONFIG(FOSC_HS&WDTE_OFF); void set(char *str);//设置命令 void sendMessage(char *str1,char *str2);//发送函数 void main() { serialInit(); set("AT");//握手 set("AT+CSCS=\"UCS2\"");//PDU set("AT+CMGF=0"); set("AT+CNMI=2,1");//设置短信接收存储位置 set("AT+CMGD=1");//删除1号位置短信 delay(100); while(1) { while(strstr(Rec_Buf,"+CMTI")) { Clr_Buf(); sendStringln("AT+CMGR=1"); delay(100); while(strstr(Rec_Buf,"OK") == NULL); delay(100); if

Pic16f684 & dual seven seg display program: random number generator in C

萝らか妹 提交于 2020-08-08 05:50:18
问题 I'm trying to convert this code to be able to generate random numbers 1-56. I would understand, but because the program has to switch back and forth to be able to show both digits, I'm confused. I know in some respect, I can use rand() to choose. I will eventually use this code in junction with an lcd screen to display the numbers as well as the dual seven segment display, but for now, just trying to figure out to program a PIC16F684 to generate the random number on the dua84l seven seg