User Tools

Site Tools


dev8051:code8051

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
dev8051:code8051 [2026/02/09 22:19] – created - external edit 127.0.0.1dev8051:code8051 [2026/04/28 01:27] (current) – [Code: Testing Base Kit] azman
Line 3: Line 3:
 Example codes (in C) for the classical Intel-8051 (mcu51) microcontroller core. Using my1code51 library. Tested using sdcc open source compiler and stc12 device. Example codes (in C) for the classical Intel-8051 (mcu51) microcontroller core. Using my1code51 library. Tested using sdcc open source compiler and stc12 device.
  
-===== Codes for NMK322 ===== +===== Code: IR module and Ultrasonic sensor module =====
- +
-Codes to test hardware modules available for our NMK322 Microcontroller lab.   +
- +
-==== Code: IR module and Ultrasonic sensor module ====+
  
 ++++ Testing IR module and HC-SR04 ultrasonic sensor module. | ++++ Testing IR module and HC-SR04 ultrasonic sensor module. |
-<file c nmk322_test0.c>+<file c test0_ir_hc.c>
 /*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
 #include "uart.h" #include "uart.h"
Line 105: Line 101:
 ++++ ++++
  
-==== Code: BT module and servo ====+===== Code: BT module and servo =====
  
 ++++ Testing HC06 bluetooth module , TowerPro MG996R servo. | ++++ Testing HC06 bluetooth module , TowerPro MG996R servo. |
-<file c nmk322_test1btservo.c>+<file c test1_btservo.c>
 /*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
 /** /**
Line 268: Line 264:
  
 ++++ Testing HC06 bluetooth module , TowerPro MG996R servo & Text LCD. | ++++ Testing HC06 bluetooth module , TowerPro MG996R servo & Text LCD. |
-<file c nmk322_test1.c>+<file c test1_btservolcd.c>
 /*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
 /** /**
Line 394: Line 390:
 ++++ ++++
  
-==== Code: RFID module and OLED ====+===== Code: RFID module and OLED =====
  
 ++++ Testing RFID (FRC522) and OLED (ssd1306). | ++++ Testing RFID (FRC522) and OLED (ssd1306). |
-<file c nmk322_test2rfid.c>+<file c test2_rfid.c>
 /*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
 #include "uart_hexascii.h" #include "uart_hexascii.h"
Line 483: Line 479:
 ++++ ++++
  
-==== Code: Testing Base Kit ====+===== Code: Testing Base Kit =====
  
 ++++ Testing Base Kit (202425s1). | ++++ Testing Base Kit (202425s1). |
-<file c nmk322_basetest.c>+<file c test0_base.c>
 /*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
 /* override default tick values */ /* override default tick values */
Line 520: Line 516:
 ++++ ++++
  
-===== Code: relay ===== 
- 
-Testing basic relay. 
-<file c relay.c> 
-/*----------------------------------------------------------------------------*/ 
-#include "timer.h" 
-#include "uart.h" 
-/*----------------------------------------------------------------------------*/ 
-MY1SBIT(DRIVE,PIN20); 
-MY1SBIT(INPUT,PIN10); 
-/*----------------------------------------------------------------------------*/ 
-void main(void) { 
- unsigned char wait; 
- timer_init(); 
- uart_init(); 
- uart_puts("\nTESTING RELAY\n"); 
- DRIVE = 1; /* active low */ 
- INPUT = 1; 
- while(1) { 
- if (INPUT==0) { 
- uart_puts("-- Switch ON... "); 
- DRIVE = 0; 
- wait = 3*TIMER_LOOP_1S; 
- do { timer_wait(TIMER_VAL50MS); } while (--wait); 
- uart_puts("OFF.\n"); 
- DRIVE = 1; 
- while (!INPUT); 
- } 
- } 
-} 
-/*----------------------------------------------------------------------------*/ 
-</file> 
  
 ===== Code: gtuc51 ===== ===== Code: gtuc51 =====
dev8051/code8051.1770675564.txt.gz · Last modified: by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki