PIC单片机C编程问题,我刚从转来学这一块,以下是写的第一个程序,高手帮忙看看!!
芯片用的是PIC10F204以下是具体程序;#include"pic.h"#defineMAX_BUFFER_SIZE3bittxdata=0;//unsignedcha...
芯片用的是PIC10F204
以下是具体程序;
#include "pic.h"
#define MAX_BUFFER_SIZE 3
bit txdata = 0;
//unsigned char SPI_Data_Array[MAX_BUFFER_SIZE]={0X00};
//unsigned char SPI_Data_Array0[MAX_BUFFER_SIZE] = {0x00,0x00,0x04};
//unsigned char SPI_Data_Array1[MAX_BUFFER_SIZE] = {0x00,0x0A,0x01};
//unsigned char SPI_Data_Array2[MAX_BUFFER_SIZE] = {0x1F,0x80,0x92}; //A2
//unsigned char SPI_Data_Array3[MAX_BUFFER_SIZE] = {0x1F,0x80,0x93};
void DataTx(unsigned char * p);
void Delay(unsigned int n);
void Delay(unsigned int n)
{
unsigned char i;
while(n--)
{
for(i=0; i<225; i++);
}
}
void main(void)
{
unsigned char i = 0;
unsigned char SPI_Data_Array0[MAX_BUFFER_SIZE] = {0x00,0x00,0x04};
unsigned char SPI_Data_Array1[MAX_BUFFER_SIZE] = {0x00,0x0A,0x01};
unsigned char SPI_Data_Array2[MAX_BUFFER_SIZE] = {0x1F,0x80,0x92}; //A2
unsigned char SPI_Data_Array3[MAX_BUFFER_SIZE] = {0x1F,0x80,0x93};
unsigned char SPI_Data_Array[MAX_BUFFER_SIZE]={0X00};
Delay(500);
for(i=0; i<3; i++)
{
DataTx(&SPI_Data_Array0);
}
}
void DataTx(unsigned char * p)
{
unsigned char len = 0;
unsigned char tab = 0;
unsigned char i = 0;
for(len=0;len<MAX_BUFFER_SIZE;len++)
{
tab = *p;
for(i=0; i<8; i++)
{
txdata = (bit)(tab&1);
Delay(20);
GP1 = txdata;
tab >>= 1;
}
*p ++;
}
Delay(500);
}
总是出现以下问题:
HI-TECH C PRO for the PIC10/12/16 MCU family (Lite) V9.65
Copyright (C) 1984-2009 HI-TECH SOFTWARE
(1273) Omniscient Code Generation not available in Lite mode (warning)
Error [1253] double.c; 55. could not find space (26 bytes) for auto/param block
Error [1253] double.c; 55. could not find space (26 bytes) for auto/param block
Error [1254] double.c; 55. could not find space (12 bytes) for data block
Error [1253] D:\kk\main.c; 23. could not find space (26 bytes) for auto/param block
Error [1253] D:\kk\main.c; 23. could not find space (26 bytes) for auto/param block
Error [1254] D:\kk\main.c; 23. could not find space (12 bytes) for data block
我用的是MPLAB IDE ,C编译器用的是PICC 展开
以下是具体程序;
#include "pic.h"
#define MAX_BUFFER_SIZE 3
bit txdata = 0;
//unsigned char SPI_Data_Array[MAX_BUFFER_SIZE]={0X00};
//unsigned char SPI_Data_Array0[MAX_BUFFER_SIZE] = {0x00,0x00,0x04};
//unsigned char SPI_Data_Array1[MAX_BUFFER_SIZE] = {0x00,0x0A,0x01};
//unsigned char SPI_Data_Array2[MAX_BUFFER_SIZE] = {0x1F,0x80,0x92}; //A2
//unsigned char SPI_Data_Array3[MAX_BUFFER_SIZE] = {0x1F,0x80,0x93};
void DataTx(unsigned char * p);
void Delay(unsigned int n);
void Delay(unsigned int n)
{
unsigned char i;
while(n--)
{
for(i=0; i<225; i++);
}
}
void main(void)
{
unsigned char i = 0;
unsigned char SPI_Data_Array0[MAX_BUFFER_SIZE] = {0x00,0x00,0x04};
unsigned char SPI_Data_Array1[MAX_BUFFER_SIZE] = {0x00,0x0A,0x01};
unsigned char SPI_Data_Array2[MAX_BUFFER_SIZE] = {0x1F,0x80,0x92}; //A2
unsigned char SPI_Data_Array3[MAX_BUFFER_SIZE] = {0x1F,0x80,0x93};
unsigned char SPI_Data_Array[MAX_BUFFER_SIZE]={0X00};
Delay(500);
for(i=0; i<3; i++)
{
DataTx(&SPI_Data_Array0);
}
}
void DataTx(unsigned char * p)
{
unsigned char len = 0;
unsigned char tab = 0;
unsigned char i = 0;
for(len=0;len<MAX_BUFFER_SIZE;len++)
{
tab = *p;
for(i=0; i<8; i++)
{
txdata = (bit)(tab&1);
Delay(20);
GP1 = txdata;
tab >>= 1;
}
*p ++;
}
Delay(500);
}
总是出现以下问题:
HI-TECH C PRO for the PIC10/12/16 MCU family (Lite) V9.65
Copyright (C) 1984-2009 HI-TECH SOFTWARE
(1273) Omniscient Code Generation not available in Lite mode (warning)
Error [1253] double.c; 55. could not find space (26 bytes) for auto/param block
Error [1253] double.c; 55. could not find space (26 bytes) for auto/param block
Error [1254] double.c; 55. could not find space (12 bytes) for data block
Error [1253] D:\kk\main.c; 23. could not find space (26 bytes) for auto/param block
Error [1253] D:\kk\main.c; 23. could not find space (26 bytes) for auto/param block
Error [1254] D:\kk\main.c; 23. could not find space (12 bytes) for data block
我用的是MPLAB IDE ,C编译器用的是PICC 展开
展开全部
用的什么编译器呀,库貌似有问题,再下载一个编译器相应的库试试,上面明显是找不到相应的文件!
展开全部
PIC10F204的程序空间很小的.你可能超了.
展开全部
楼上说的有道理
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询