#pragma used



#include <stdio.h>
#include <stdlib.h>

#pragma pack(4)     //default value

#if defined(ANDROID2_0)
  	#pragma message("android-2.0")        //only VS surpose
	#define VERSION "android 2.0"
#elif defined(ANDROID4_0)
	#pragma message("android-4.0")
	#define VERSION "android 4.0"
#else
	#warning No VERSION information...
	#error VERSION Not Find...
#endif

struct t
{
	char c1;   //  char :1   pack:4;   addr 0 
	short s;   //  short:2   pack:4;   addr 2 
	char c2;   //  char :1   pack:4;   addr 4 
	int i;     //  int  :4   pack:4;   addr 8 
};

int main()
{
	printf("%s\n",VERSION);
	
	struct t t1;
	printf("%d\n",sizeof(t1));
	return 0;
}


/* * File: ADC.c * Author: tlfte *AD转换,结果在C口和D口的LED上显示,能进行各种通道选择和参考电压,结果对齐方式选择 * Created on 2018年8月6日, 上午10:07 练习AD结果的计算验证,AD_RESULT=VIN×1023÷VREF,讲解887头文件的作用 */ // PIC16F887 Configuration Bit Settings // 'C' source line config statements // CONFIG1 #pragma config FOSC = XT // Oscillator Selection bits (XT oscillator: Crystal/resonator on RA6/OSC2/CLKOUT and RA7/OSC1/CLKIN) #pragma config WDTE = OFF // Watchdog Timer Enable bit (WDT disabled and can be enabled by SWDTEN bit of the WDTCON register) #pragma config PWRTE = OFF // Power-up Timer Enable bit (PWRT disabled) #pragma config MCLRE = ON // RE3/MCLR pin function select bit (RE3/MCLR pin function is digital input, MCLR internally tied to VDD) #pragma config CP = OFF // Code Protection bit (Program memory code protection is disabled) #pragma config CPD = OFF // Data Code Protection bit (Data memory code protection is disabled) #pragma config BOREN = OFF // Brown Out Reset Selection bits (BOR disabled) #pragma config IESO = OFF // Internal External Switchover bit (Internal/External Switchover mode is disabled) #pragma config FCMEN = OFF // Fail-Safe Clock Monitor Enabled bit (Fail-Safe Clock Monitor is disabled) #pragma config LVP = OFF // Low Voltage Programming Enable bit (RB3 pin has digital I/O, HV on MCLR must be used for programming) // CONFIG2 #pragma config BOR4V = BOR40V // Brown-out Reset Selection bit (Brown-out Reset set to 4.0V) #pragma config WRT = OFF // Flash Program Memory Self Write Enable bits (Write protection off) // #pragma config statements should precede project file includes. // Use project enums instead of #define for ON and OFF. #include <xc.h> #define _XTAL_FREQ 4000000 //指明时钟晶振为4MHz,使delay宏定义可以正常使用 void CSH(void); unsigned int AD_SUB(char k); void main( ) { unsigned int y; CSH(); while(1) { __delay_ms(100); //每隔100毫秒循环一次 y=AD_
最新发布
05-24
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值