linux之點亮led燈出現的無效運算元 問題

2021-06-21 23:07:41 字數 1043 閱讀 3319

linux中點亮led燈時出現無效運算元的錯誤,源**如下:

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

volatile unsigned long gpbcon = null;

volatile unsigned long *gpbdat = null;

static struct class *firstdrv_class;

static struct class_device *firstdrv_class_dev;

int first_drv_open(struct inode *inode, struct file *file)

ssize_t first_drv_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)

else

//printk("first_drv_write\n");

return 0;

}struct file_operations first_drv_fops=;

int major;

int first_drv_init(void)

void first_drv_exit(void)

module_init(first_drv_init);

module_exit(first_drv_exit);

module_license("gpl");

執行結果如下:

上面數24.25.37.47無效的運算元錯誤

認真閱讀** 發現 **中的gpbcon和gpbdat為位址,給其賦值是前面應該加「*」號,加上之後儲存執行正確!

點亮LED燈(一)

想當初都是用彙編來編寫微控制器的程式,那滋味現在想來都是滿滿的回憶,還是用c語言寫起來爽快啊!用c寫微控制器程式,只需要引入標頭檔案即可,實際上該標頭檔案只是定義了特殊功能暫存器位址。為了今後使用方便,我們封裝乙個函式,用來開關led燈,通過引數來控制操作的p埠,並且引入掩碼來操作單個和多個bit位...

點亮led燈的個數 LED燈的點亮電流一般是多少

幸福的小貓zz 正常說,9 15w就行了。小於6w亮度不夠。此外,還要看看用於哪,照射面積多大?papapaopao led照明電路通常都沒有保險設計,何況裝飾燈珠工作電流不大,這種規格的保險也很難找。沙沙小小囡 推薦一般情況下,民用電壓實際要比220v略低一些。好比你買個標識為4g的優盤,實際只有...

Uboot中點亮LED燈

1 硬體要求 1 at91sam9260平台 2 pc6 pc10 兩個引腳連測試板的兩個 led燈 2 u boot版本 u boot 1.3.4 3 實現過程 在原始碼 u boot 1.3.4 board atmel at91sam9260ek at91sam9260ek.c 檔案的中做如下操...