- 2024-12-22
-
回复了主题帖:
人体红外感应的问题
tagetage 发表于 2024-12-21 17:31
实物拍个照片啊。。
明天拍
- 2024-12-20
-
发表了主题帖:
人体红外感应的问题
这个手册找不到
我自己写了个测试程序:
GPIO_InitStruct.Pin = GPIO_PIN_15;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_PULLUP;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
i=HAL_GPIO_ReadPin(GPIOA,GPIO_PIN_15);
if(i==0)
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_4, GPIO_PIN_RESET);
else
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_4, GPIO_PIN_SET);
可是我手不靠近红外人体感应模块,灯也亮。
请问高手,怎么回事?如何解决?谢谢
- 2024-12-18
-
回复了主题帖:
移动硬盘的问题
分区助手创建分区失败
-
回复了主题帖:
移动硬盘的问题
这个怎么办?也没有进度提示?谢谢
-
回复了主题帖:
移动硬盘的问题
Verifone 发表于 2024-12-17 23:23
用分区助手,分区魔法师,很多软件都有这个功能,我个人喜欢用分区助手
谢谢
- 2024-12-17
-
回复了主题帖:
移动硬盘的问题
qwqwqw2088 发表于 2024-12-17 21:08
系统还能识别出来,应该没有坏,重新格式化如不行,就分区试试
谢谢!用什么软件分区?
-
回复了主题帖:
移动硬盘的问题
我用一种格式化软件格式化移动硬盘,显示如下:
-
发表了主题帖:
移动硬盘的问题
这个移动硬盘前面有个红圈,是不是坏掉了?谢谢
- 2024-12-16
-
回复了主题帖:
我想学MQTT
flyaqiao 发表于 2024-12-16 18:15
这个简单呀,学呗,一个WIFI模块就行了.ESP的资料最多了.
谢谢
-
发表了主题帖:
我想学MQTT
我想学MQTT,不知道如何入手。
我看淘宝上有这种模块卖,听说它是用来连网的,连服务器。也可以给其他mqtt设备发数据
那我买模块是买一个好,还是买两个。
请高手指教,谢谢!
-
回复了主题帖:
STC8H1K28内部晶振是多少Hz
tagetage 发表于 2024-12-16 16:01
STC8H 系列单片机是不需要外部晶振和外部复位的单片机,是以超强抗干扰/超低价/高速/低功耗为目标的 8051 ...
谢谢
-
发表了主题帖:
STC8H1K28内部晶振是多少Hz
请问高手,STC8H1K28内部晶振是多少Hz?谢谢!手册上没找到。
- 2024-12-13
-
回复了主题帖:
读写ISL12026EEPROM失败
wangerxian 发表于 2024-12-12 16:22
啥问题,是写不进去吗?
不知道,写了读出来不对。
- 2024-12-10
-
发表了主题帖:
读写ISL12026EEPROM失败
代码:
#include<reg51.h>
#include"OLED.H"
extern unsigned char code Dot[];
#define uint unsigned int
#define uchar unsigned char
#define UINT8 unsigned char
#define HMS_FLAG 1
//--------与24C02相关的设置和子函数-------------
void delay(){ ;;;;;;;;;;;;;; ;;;;;;;;;;;;;;} //简单短延时子函数
sbit sda_24c02=P2^6; //定义24C02的数据线与单片机的连接
sbit scl_24c02=P2^7;
void start_24c02(); //24C02开始信号
void stop_24c02(); //24C02停止
void respons_24c02(); //24C02应答
void init_24c02(); //24C02初始化
void write_byte_24c02(uchar date); //写一个byte到24C02
uchar read_byte_24c02(); //从24C02读一个byte
void write_add_24c02(uchar address,uchar date); //写一个字节到指定的24C02单元
uchar read_add_24c02(uchar address); //从24C02指定单元读一个字节数据
void write_add1_24c02(uchar address,uchar date); //写一个字节到指定的24C02单元
uchar read_add1_24c02(uchar address); //从24C02指定单元读一个字节数据
void XWrite_eeprom(UINT8 Address,UINT8 eeprom_Data);
UINT8 XRead_eeprom(UINT8 Address);
sbit led=P1^0;
unsigned char code table_num[]="0123456789"; //LCD显示的数字代码
void delay_ms(uint xms); //ms级延时子函数
unsigned char i; //
struct ccb
{
uchar second;
uchar minute;
uchar hour;
uchar day;
uchar month;
uchar year;
};
struct ccb CurrentTime;
UINT8 Change10ToBCD(UINT8 data1) //10->BCD数值转化
{
UINT8 high,low,result;
high=data1/10;
low=data1%10;
result=(high<<4)|low;
return result;
}
void init_ISL12026()
{
XWrite_eeprom(0x3F,0x02);
XWrite_eeprom(0x3F,0x06);
}
void ResetRtcTime()
{
init_ISL12026();
XWrite_eeprom(0x37,Change10ToBCD(20));//世纪
XWrite_eeprom(0x36,Change10ToBCD(0));//周
XWrite_eeprom(0x35,Change10ToBCD(10));//年
XWrite_eeprom(0x34,Change10ToBCD(1));//月
XWrite_eeprom(0x33,Change10ToBCD(1));//日
XWrite_eeprom(0x32,Change10ToBCD(12)|0x80);//时
XWrite_eeprom(0x31,Change10ToBCD(12));//分
XWrite_eeprom(0x30,Change10ToBCD(12));//秒
}
UINT8 ChangeBCDTo10(UINT8 data1) //BCD->10数值转化
{
UINT8 temp,result;
result=data1&0x0F;
temp=data1>>4;
result+=temp*10;
return result;
}
void readCurrentTime()
{
CurrentTime.year=ChangeBCDTo10(XRead_eeprom(0x35));
CurrentTime.month=ChangeBCDTo10(XRead_eeprom(0x34));
CurrentTime.day=ChangeBCDTo10(XRead_eeprom(0x33));
CurrentTime.hour=ChangeBCDTo10(XRead_eeprom(0x32)&0x7F);
CurrentTime.minute=ChangeBCDTo10(XRead_eeprom(0x31));
CurrentTime.second=ChangeBCDTo10(XRead_eeprom(0x30));
}
/**************************************************************************/
//按页写入。 pBuffer数组指针首地址,WriteAddr要写入页的首地址,NumByteToWrite写入字符个数
/*************************************************************************/
void ISL12026_PageWrite(UINT8* pBuffer, UINT8 WriteAddr, UINT8 NumByteToWrite)
{
init_ISL12026();
//XStart_iic();
start_24c02();
write_byte_24c02(0xde);
respons_24c02();
//XWriteByte(0);
//XReceiveAck();
write_byte_24c02(0);
respons_24c02();
//XWriteByte(WriteAddr);
//XReceiveAck();
write_byte_24c02(WriteAddr);
respons_24c02();
while(NumByteToWrite--)
{
//XWriteByte(*pBuffer);
//Point to the next byte to be written
write_byte_24c02(*pBuffer);
respons_24c02();
pBuffer++;
//XReceiveAck();
}
//XStop_iic();
stop_24c02();
for(i=0;i<40;i++)
delay();
}
/**************************************************************************/
//写入时间信息,按照秒,分,时,天,月,年的顺序写入
/*************************************************************************/
void ISL12026_TimeWrite(UINT8 second,UINT8 minute,UINT8 hour,UINT8 day,UINT8 month,UINT8 year)
{
UINT8 temp[8];
temp[0]=Change10ToBCD(second);
temp[1]=Change10ToBCD(minute);
temp[2]=Change10ToBCD(hour)|0x80;
temp[3]=Change10ToBCD(day);
temp[4]=Change10ToBCD(month);
temp[5]=Change10ToBCD(year);
temp[6]=Change10ToBCD(0); //周,不用则写0
temp[7]=Change10ToBCD(20);
ISL12026_PageWrite(temp,0x30,8);
}
/*
void saveX1226(UINT8 hour_year,UINT8 minute_month,UINT8 second_day,UINT8 index)
{
init_X1226();
if(index==HMS_FLAG)//写时分秒
{
XWrite_eeprom(0x30,Change10ToBCD(second_day));//秒
XWrite_eeprom(0x31,Change10ToBCD(minute_month));//分
XWrite_eeprom(0x32,Change10ToBCD(hour_year)|0x80);//时
}
else//写年月日星期
{
XWrite_eeprom(0x33,Change10ToBCD(second_day));//日
XWrite_eeprom(0x34,Change10ToBCD(minute_month));//月
XWrite_eeprom(0x35,Change10ToBCD(hour_year));//年
}
XWrite_eeprom(0x11,0x00);//按定时输出
//XWrite_eeprom(0x3F,0x00);
Delay(50);
}*/
/*void init_ISL12026_IQR()
{
//UINT8 mRtcStatus;
init_ISL12026();
//mRtcStatus=ChangeBCDTo10(XRead_eeprom(0x11));
//mRtcStatus=mRtcStatus;
XWrite_eeprom(0x11,0x00);//0x18, 1秒一个频冲
//Delay(100);
for(i=0;i<80;i++)
delay();
} */
void init_ISL12026_Alarm(UINT8 Hour_Week,UINT8 Minute_Month,UINT8 Second_Day,UINT8 index) // 设置报警时间
{
init_ISL12026();
if(index==HMS_FLAG)//写时分秒
{
XWrite_eeprom(0x00,Change10ToBCD(Second_Day));//秒
XWrite_eeprom(0x01,Change10ToBCD(Minute_Month));//分
XWrite_eeprom(0x02,Change10ToBCD(Hour_Week)|0x80);//时
}
else//写月日星期
{
XWrite_eeprom(0x03,Change10ToBCD(Second_Day));//日
XWrite_eeprom(0x04,Change10ToBCD(Minute_Month));//月
XWrite_eeprom(0x06,Change10ToBCD(Hour_Week));//年
}
XWrite_eeprom(0x11,0xA0);//按定时输出
//Delay(50);
for(i=0;i<40;i++)
delay();
}
void PowerInitTime(void)
{
struct ccb DownTime;
UINT8 mRtcStatus;
init_ISL12026();
//mRtcStatus=XRead_eeprom(0x14);
XWrite_eeprom(0x14,0x00);
mRtcStatus=XRead_eeprom(0x14);
mRtcStatus=ChangeBCDTo10(XRead_eeprom(0x3F));
if ( mRtcStatus & 0x01 ) //如果完全断电,设置为上次参数下载的时间
{
/*DownTime.year=ByteReadEeprom(DownLoadYearAddrOne);
DownTime.month=ByteReadEeprom(DownLoadMonthAddrOne);
DownTime.day=ByteReadEeprom(DownLoadDayAddrOne);
DownTime.hour=ByteReadEeprom(DownLoadHourAddrOne);
DownTime.minute=ByteReadEeprom(DownLoadMinuteAddrOne);
DownTime.second=ByteReadEeprom(DownLoadSecondAddrOne);
*/
ISL12026_TimeWrite(DownTime.second,DownTime.minute,DownTime.hour,DownTime.day,DownTime.month,DownTime.year);
}
}
void readSecond()
{
//CurrentTime.minute=ChangeBCDTo10(XRead_eeprom(0x31));
CurrentTime.second=ChangeBCDTo10(XRead_eeprom(0x30));
}
void main(void)
{
unsigned int i;
unsigned char temp;
unsigned char second;
unsigned char bai,shi,ge;
unsigned char year,month,day,hour,minute;
LCD_Init();
LCD_CLS();
//LCD_P8x16Str(45,5,(u8*)"EASEAR");
//LCD_P6x8Str(0,7,(u8*)"www.holteksupport.com");
//Draw_BMP(0,0,100,3,(u8*)Dot);
init_ISL12026();
//XWrite_eeprom(0x3F,0x82);
//delay2();
//XWrite_eeprom(0x3F,0x86);
XWrite_eeprom(0x50,209);//
for(i=0;i<60000;i++);
XWrite_eeprom(0x52,126);//
for(i=0;i<60000;i++);
XWrite_eeprom(0x54,158);//
for(i=0;i<60000;i++);
temp=XRead_eeprom(0x52);
bai=temp/100+48;
shi=temp%100/10+48;
ge=temp%10+48;
LCD_P8x16Char(0,0,bai);
LCD_P8x16Char(8,0,shi);
LCD_P8x16Char(16,0,ge);
temp=XRead_eeprom(0x54);
bai=temp/100+48;
shi=temp%100/10+48;
ge=temp%10+48;
LCD_P8x16Char(32,0,bai);
LCD_P8x16Char(40,0,shi);
LCD_P8x16Char(48,0,ge);
temp=XRead_eeprom(0x50);
bai=temp/100+48;
shi=temp%100/10+48;
ge=temp%10+48;
LCD_P8x16Char(64,0,bai);
LCD_P8x16Char(72,0,shi);
LCD_P8x16Char(80,0,ge);
//XWrite_eeprom(0x10,0x00);//去除写保护
/*XWrite_eeprom(0x37,0x06);//
second=XRead_eeprom(0x3f);
bai=second/100;
shi=second%100/10;
ge=second%10;
lcd_display_char(12,0,bai+0x30);
lcd_display_char(13,0,shi+0x30);
lcd_display_char(14,0,ge+0x30);
//XWrite_eeprom(0x3f,0x00);//
XWrite_eeprom(0x14,0x00);// */
//XWrite_eeprom(0x10,0x00);//去除写保护
LCD_P8x16Str(0,2,(u8*)" : : ");
LCD_P8x16Str(0,4,(u8*)"20 - - ");
ISL12026_TimeWrite(50,59,23,31,12,23);
while(1)
{
// readSecond();
readCurrentTime();
shi=(CurrentTime.second/10)+0x30;
ge=(CurrentTime.second%10)+0x30;
LCD_P8x16Char(48,2,shi);
LCD_P8x16Char(56,2,ge);
shi=(CurrentTime.minute/10)+0x30;
ge=(CurrentTime.minute%10)+0x30;
LCD_P8x16Char(24,2,shi);
LCD_P8x16Char(32,2,ge);
shi=(CurrentTime.hour/10)+0x30;
ge=(CurrentTime.hour%10)+0x30;
LCD_P8x16Char(0,2,shi);
LCD_P8x16Char(8,2,ge);
shi=(CurrentTime.day/10)+0x30;
ge=(CurrentTime.day%10)+0x30;
LCD_P8x16Char(64,4,shi);
LCD_P8x16Char(72,4,ge);
shi=(CurrentTime.month/10)+0x30;
ge=(CurrentTime.month%10)+0x30;
LCD_P8x16Char(40,4,shi);
LCD_P8x16Char(48,4,ge);
shi=(CurrentTime.year/10)+0x30;
ge=(CurrentTime.year%10)+0x30;
LCD_P8x16Char(16,4,shi);
LCD_P8x16Char(24,4,ge);
for(i=0;i<20000;i++);
}
}
void delay_ms(uint xms) //ms级延时子程序
{ unsigned int aa,bb;
for(aa=xms;aa>0;aa--)
for(bb=4000;bb>0;bb--); //调整数值以使本句运行时间为1ms
}
//--------与24C02相关的设置和子函数-------------
void start_24c02() //24c02开始信号
{ sda_24c02=1; delay();
scl_24c02=1; delay();
sda_24c02=0; delay(); }
void stop_24c02() //24c02停止
{ sda_24c02=0; delay();
scl_24c02=1; delay();
sda_24c02=1; delay(); }
void respons_24c02() //24c02应答
{ uchar i;
scl_24c02=1;
delay();
while((sda_24c02==1)&&(i<250))i++;
scl_24c02=0;
delay(); }
void init_24c02() //24c02初始化
{ sda_24c02=1; delay();
scl_24c02=1; delay(); }
void write_byte_24c02(uchar date) //写8个
{ uchar i,temp;
temp=date;
for(i=0;i<8;i++)
{ temp=temp<<1;
scl_24c02=0; delay();
sda_24c02=CY; delay();
scl_24c02=1; delay();
}
scl_24c02=0; delay();
sda_24c02=1; delay(); }
uchar read_byte_24c02()
{ uchar i,k;
scl_24c02=0; delay();
sda_24c02=1; delay();
for(i=0;i<8;i++)
{ scl_24c02=1; delay();
k=(k<<1)|sda_24c02;
scl_24c02=0; delay();
}
return k; }
void write_add_24c02(uchar address,uchar date)//将某数据写入24C02某个单元中
{ start_24c02();
write_byte_24c02(0xa0); //24c02的写地址(1010 0000)
respons_24c02();
write_byte_24c02(address);
respons_24c02();
write_byte_24c02(date);
respons_24c02();
stop_24c02(); }
uchar read_add_24c02(uchar address)//读出24c02某个单元数据到变量中
{ uchar date;
start_24c02();
write_byte_24c02(0xa0); //24c02的读地址(1010 0001)
respons_24c02();
write_byte_24c02(address);
respons_24c02();
start_24c02();
write_byte_24c02(0xa1);
respons_24c02();
date=read_byte_24c02();
stop_24c02();
return date; }
//--------与24C02相关的设置和子函数 结束-----------
void write_add1_24c02(uchar address,uchar date)//将某数据写入24C02某个单元中
{ start_24c02();
write_byte_24c02(address<<1);
respons_24c02();
write_byte_24c02(date);
respons_24c02();
stop_24c02(); }
uchar read_add1_24c02(uchar address)//读出24c02某个单元数据到变量中
{ uchar date;
start_24c02();
write_byte_24c02((address<<1)+1);
respons_24c02();
//start_24c02();
//write_byte_24c02(0xa1);
//respons_24c02();
date=read_byte_24c02();
stop_24c02();
return date; }
void XWrite_eeprom(UINT8 Address,UINT8 eeprom_Data)
{
//XStart_iic();
start_24c02();
//XWriteByte(0xDE);
write_byte_24c02(0xde);
//XReceiveAck();
respons_24c02();
/*XWriteByte(0);
XReceiveAck();
XWriteByte(Address);
XReceiveAck();
XWriteByte(eeprom_Data);
XReceiveAck();
XStop_iic();*/
write_byte_24c02(0);
//XReceiveAck();
respons_24c02();
write_byte_24c02(Address);
//XReceiveAck();
respons_24c02();
write_byte_24c02(eeprom_Data);
//XReceiveAck();
respons_24c02();
stop_24c02();
}
UINT8 XRead_eeprom(UINT8 Address)
{
UINT8 rdata;
//XStart_iic();
//XWriteByte(0xDE);
//XReceiveAck();
start_24c02();
write_byte_24c02(0xde);
respons_24c02();
//XWriteByte(0);
//XReceiveAck();
//XWriteByte(Address);
//XReceiveAck();
write_byte_24c02(0);
respons_24c02();
write_byte_24c02(Address);
respons_24c02();
/*XStart_iic();
XWriteByte(0xDF);
XReceiveAck();
rdata=XReadByte();
XNo_Acknowledge();
XStop_iic(); */
start_24c02();
write_byte_24c02(0xdf);
respons_24c02();
rdata=read_byte_24c02();
stop_24c02();
return(rdata);
}
读写时间都没问题。读写EEPROM,读出来都是158,也就是最后写进去的值。
请问高手,哪里有错?谢谢
- 2024-12-09
-
发表了主题帖:
计数型信号量的问题
代码:
#include "at32l021_board.h"
#include "at32l021_clock.h"
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
#include "semphr.h"
/** @addtogroup UTILITIES_examples
* @{
*/
QueueHandle_t CountSemaphore;
//unsigned char flag=0;
/** @addtogroup FreeRTOS_demo
* @{
*/
button_type key=1;
//extern QueueHandle_t xQueueCreateCountingSemaphore( const UBaseType_t uxMaxCount,
//const UBaseType_t uxInitialCount );
static void vPeriodicTassk(void *pvParamters)
{
unsigned int i;
UBaseType_t err;
while(1)
{
key=at32_adatin_state();
if(key==0)
{
for(i=0;i<3000;i++)
{
key=at32_adatin_state();
if(key==0)
{
while(1)
{
key=at32_adatin_state();
if(key==1)
break;
}
if(CountSemaphore!=NULL)
{
err=xSemaphoreGive(CountSemaphore);
if(err==pdFALSE)
{
printf("Sem Rele Failed!\r\n");
//flag=0;
}
else
{
printf("Sem Role Succeed!\r\n");
//flag=1;
}
}
}
}
//LED0_TOGGLE();
//vTaskDelay(10);
}/* 延时1000ticks */
}
}
static void vHandlerTask(void *pvParamters)
{
unsigned int i;
UBaseType_t semavalue=0;
while(1)
{
if(CountSemaphore!=NULL)
{
//if(flag==1)
//{
// flag=0;
xSemaphoreTake(CountSemaphore,portMAX_DELAY);
semavalue=uxSemaphoreGetCount(CountSemaphore);
printf("semavalue value=%d\r\n",(int)semavalue);
//}
}
//else
//{
// for(i=0;i<1000;i++);
//}
//printf("Task2 Running!\r\n");
//vTaskDelay(1000);
for(i=0;i<60000;i++);
}
}
/**
* [url=home.php?mod=space&uid=159083]@brief[/url] main function.
* @param none
* @retval none
*/
int main(void)
{
system_clock_config();
at32_board_init();
/* init led2 and led3 */
at32_led_init(LED2);
at32_led_init(LED3);
/* init usart1 */
uart_print_init(115200);
/* enter critical */
taskENTER_CRITICAL();
CountSemaphore=xSemaphoreCreateCounting(10,10);
if(CountSemaphore==NULL)
{
printf("create CountSemaphore failed!\r\n");
}
/* create led2 task */
xTaskCreate((TaskFunction_t )vPeriodicTassk,
(const char* )"vTask1",
(uint16_t )128,
(void* )NULL,
(UBaseType_t )2,
(TaskHandle_t* )NULL);
/* create led3 task */
xTaskCreate((TaskFunction_t )vHandlerTask,
(const char* )"vTask2",
(uint16_t )128,
(void* )NULL,
(UBaseType_t )2,
(TaskHandle_t* )NULL) ;
/* exit critical */
taskEXIT_CRITICAL();
/* start scheduler */
vTaskStartScheduler();
}
/**
* @}
*/
/**
* @}
*/
这个程序,一运行就收到信号量
到零后,按下按键,发送成功,可是收不到信号量。
请问高手,这个程序有什么问题?谢谢
-
回复了主题帖:
设置局域网能访问Jupyter Lab失败
tagetage 发表于 2024-12-8 15:10
建议你树莓派重新做一下系统,重新安装jupyter lab后再设定局域网访问。
谢谢,我试试
- 2024-12-08
-
回复了主题帖:
设置局域网能访问Jupyter Lab失败
tagetage 发表于 2024-12-7 17:42
问题说清楚了。你现在局域网能访问Jupyter Lab了吗????
不能
- 2024-12-07
-
回复了主题帖:
设置局域网能访问Jupyter Lab失败
tagetage 发表于 2024-12-7 15:10
Raspberry pi 树莓派安装 Jupyter lab通用于(4B-3B+)
https://blog.csdn.net/qq_43100539/article/det ...
谢谢,现在除了新的问题
找不到下面这个位置
请多指教,谢谢
-
回复了主题帖:
FREERTOS编译错误的问题
andeyqi 发表于 2024-12-7 12:21
是不是这里面的 --far 或者 --interrupt 没有被正常识别编译器不认识报错了
那怎么改呀
-
发表了主题帖:
设置局域网能访问Jupyter Lab失败
先上图:
我在学习树莓派,遇到问题。
请问高手,这个问题如何解决?谢谢