EXAMPLEs

BASCOM - BASIC

C Compiler - µC/51

As following you can find a wide range of demo programs. The programs have been realized to be used on a well-known hardware, as the K51-AVR or the KND 08, or the similar ones, in order to avoid any doubts about the interpretation of the results.

The DEMO programs are well documented in order to allow a fast approach for each users. Furthermore a list of proper demo programs have been developed for DEMO versions of BASCOM and µC/51 compilers to allow a real evaluation of the comilers, even without purhasing them. These demo programs are full of Remarks that help the user, during learning and testing phases.

I N D E X

B A S I C

C Compiler


SHORT PROGRAM DESCRIPTION

 


x_AD11

This program monitors one analogic channel out of eleven, managed by IC12 (TLC2543), visualization of the channel is in hexadecimal format, through T1 and T2 the channel to convert is selected, T1 increments while T2 decrements.
The display shows first the channel being converted, then the 12 bits wide hexadecimal value of the channel converted: Before compiling set in menu Option/Compiler/Misc: Byte End 5F; Register File 89c1051.DAT or 8052.DAT.
For use with 8xC51/52 modify the source where the pins used are described replacing pins for 89c1051 with pins for 8xc51.


x_AD4

This program monitors one analogic channel out of four, managed by IC12 (PCF8591), visualization of the channel is in hexadecimal format, through T1 the channel to convert is selected: Whenever a key is pressed, an acoustic signal is emitted.
Display DY1 shows the channel to convert, while displays DY3 and DY4 show the converted value in HEX.
Before compiling set in menu Option/Compiler/Misc: Byte End 5F; Register File 89c1051.DAT or 8052.DAT.
For use with 8xC51/52 modify the source where the pins used are described replacing pins for 89c1051 with pins for 8xc51.


x_DA

This program monitors one D/A converter channel on IC2 (PCF8591), key T1 increments the value, while key T2 decrements the value which is shown in hexadecimal formaton the 7 sements displays.
Whenever a key is pressed, an acoustic signal is emitted.
Before compiling set in menu Option/Compiler/Misc: Byte End 5F; Register File 89c1051.DAT or 8052.DAT.
For use with 8xC51/52 modify the source where the pins used are described replacing pins for 89c1051 with pins for 8xc51.


x_REE

This program allows to read a serial EEPROM on IC4 (max 24c08), with addresses ranging from &H400 to &H7ff, addresses from &H0 to &H0FF are taken by IC7 (RTC PCF8583) while addresses from &H100 to &H3FF are free space.
At start the program shows the address where to write, through keys T1 and T2 the value in incremented or decremented.
Through key T3 the address is accepted and the value read at such address is shown.
Whenever a key is pressed, an acoustic signal is emitted.
Before compiling set in menu Option/Compiler/Misc: Byte End 5F; Register File 89c1051.DAT or 8052.DAT.
For use with 8xC51/52 modify the source where the pins used are described replacing pins for 89c1051 with pins for 8xc51.


x_WEE

This program allows to write to a serial EEPROM on IC4 (max 24c08), with addresses ranging from &H400 to &H7ff, addresses from &H0 to &H0FF are taken by IC7 (RTC PCF8583) while addresses from &H100 to &H3FF are free space.
At start the program shows the address where to write, through keys T1 and T2 the value in incremented or decremented.
Through key T3 the address is accepted, then the value to write is selected through T1 and T2, as last press key T3 to write.
Whenever a key is pressed, an acoustic signal is emitted.
After the operation is terminated the selected address and the written data are shown one after the other.
Before compiling set in menu Option/Compiler/Misc: Byte End 5F; Register File 89c1051.DAT or 8052.DAT.
For use with 8xC51/52 modify the source where the pins used are described replacing pins for 89c1051 with pins for 8xc51.


x_LCD

This program allows to manage an alphanumeric LCD featuring a number rows and columns definible bythe User.
The display must be connected to CN5 following the connections shown in the diagram of K51-AVR page 4 of 4.

Before compiling select in menu Option/Compiler/Misc/ :

Byte End 5F, Register File REG51.DAT

In menu Option/ LCD select:

Db4 = P1.5 , Db5 = P1.6 , Db6 = P1.7 , Db7 = P1.2 , E = P1.4 , Rs = P1.3


x_RS232

This program sends to the serial line, set with 19.200 Baud, character "1" if T1 is pressed or character "2" if T2 is pressed.
It also shows on the 7 segment display the hexadecimal numeric value of last byte received from serial port.


 LCD_2

L C D 2 - RS 232 Serial Video Terminal


x_PPI

This program shows, in hexadecimal format, the status of the eight lines connected to IC1 (PCF8547A9).
Before compiling set in menu Option/Compiler/Misc: Byte End 5F; Register File 89c1051.DAT or 8052.DAT.
For use with 8xC51/52 modify the source where the pins used are described replacing pins for 89c1051 with pins for 8xc51.


x_PPO

This program activates sequentially one at a time all the 8 lines connected to IC1 (PCF8574A).
Before compiling set in menu Option/Compiler/Misc: Byte End 5F; Register File 89c1051.DAT or 8052.DAT.
For use with 8xC51/52 modify the source where the pins used are described replacing pins for 89c1051 with pins for 8xc51.


x_PPO2

This program turns on in sequence the 16 TTL lines available on connector CN3.

Before compiling select in menu Option/Compiler/Misc/ :

Byte End 5F; Register File 8052.DAT


x_RTC

This program allows to show the RTC or Real Time Clock on IC7 (PCF8583) to the four 7 segments displays: To set the RTC values keys T2 and T3 are used, in detail key T2 increments the hours and T3 increments the minutes.
Whenever one of the two keys is pressed the seconds are reset.
Key T1 switches between visualization of seconds and hours.
Whenever a key is pressed, an acoustic signal is emitted.
Date and eventual alarm are not managed: Before compiling set in menu Option/Compiler/Misc: Byte End 5F; Register File 89c1051.DAT or 8052.DAT.
For use with 8xC51/52 modify the source where the pins used are described replacing pins for 89c1051 with pins for 8xc51.


x_TER

This program reads the temperature measured by IC3 (DS1621) and shows it in centigrad degreeses with values ranging from -55 to +125.
Before compiling set in menu Option/Compiler/Misc: Byte End 5F; Register File 89c1051.DAT or 8052.DAT.
For use with 8xC51/52 modify the source where the pins used are described replacing pins for 89c1051 with pins for 8xc51.


BASCOM Examples for boards 

KND_08 - KND_44 - KAD_08


KND_08

This program allows to manage the board resources of KND 08 card through a menu, using 2 TTL lines driven by a familiy 51 microcontroller.
This program is managed through a RS 232 serial line, so it is essential to connect a free COM port of the PC to connector CN2 of K51-AVR.
To configure the BASCOM 8051 terminal in menu Options/Communication select the COM port and set Baud Rate to 19200, parity to none, databits to 8, stopbits to 1.
The board used to drive KND 08 is K51-AVR, connections are:

K51-AVR ................ KND 08
L1 (pin4 CN6) ----> SC (pin2 CN1 KND08)
L2 (pin5 CN6) ----> SD (pin1 CN1 KND08)

Supply both the boards.
Before compiling in menu Option/Compiler/Misc set Byte End(Hex) = 60.


KND_44

This program allows to manage the board resources of KND 44 card through a menu, using 2 TTL lines driven by a familiy 51 microcontroller.
This program is managed through a RS 232 serial line, so it is essential to connect a free COM port of the PC to connector CN2 of K51-AVR.
To configure the BASCOM 8051 terminal in menu Options/Communication select the COM port and set Baud Rate to 19200, parity to none, databits to 8, stopbits to 1.
The board used to drive KND 44 is K51-AVR, connections are.

K51-AVR .................. KND 44
L1 (pin4 CN6) ----> SC (pin2 CN1 KND44)
L2 (pin5 CN6) ----> SD (pin1 CN1 KND44)

Supply both the boards.
Before compiling in menu Option/Compiler/Misc set Byte End(Hex) = 60.


KAD_08

This program manages a sliding alphanumeric message on eight 14-segments displays, installed on KAD 08 board, through 2 TTL signals driveb by a microcontroller of family 51.
The master board is K51-AVR which must be connected to KAD 08 as follows:

K51-AVR ........... KAD 08
L1 (pin4 CN6) ----> SC (pin2 CN1 KAD08)
L2 (pin5 CN6) ----> SD (pin1 CN1 KAD08)

Supply both the boards.
Before compiling in menu Option/Compiler/Misc set Byte End(Hex) = 70.


KAD_08_2

This program allows to manage the resources on the KAD 08 board through a menu and 2 TTL lines driven by a microcontroller of the 51 family.
This program is controlled through the RS 232 serial line so it is essential to connect a free COM port on the PC to the connector CN2 of K51-AVR.
Configure the BASCOM 8051 terminal using menu Option/Communication, select the COM port and set baud rate to 19200, parity to none, databits to 8 and stopbits to 1.
The master board is K51-AVR which must be connected to KAD 08 as follows:

K51-AVR ........... KAD 08
L1 (pin4 CN6) ----> SC (pin2 CN1 KAD08)
L2 (pin5 CN6) ----> SD (pin1 CN1 KAD08)

Supply both the boards.
Before compiling in menu Option/Compiler/Misc set Byte End(Hex) = 50.


 EXAMPLEs

BASCOM - LT 

For K51-AVR Boards

 

 K51-AVR

DEMO_AD11, DEMO_AD4, DEMO_DA, DEMO_REE, DEMO_WEE, DEMO_LCD, DEMO_PPI, DEMO_PPI1, DEMO_PPO, DEMO_PPO1, DEMO_PPO2_CN3, DEMO_RTC, DEMO_TER,


  EXAMPLEs

BASCOM - 8051

 For K51-AVR Boards

  

 K51-AVR

51_AD11, 51_AD11_40, 51_AD4, 51_AD4_40, 51_DA, 51_DA_40, 51_REE, 51_REE_40, 51_WEE, 51_WEE_40, 51_LCD, LCD_2, RS232, 51_RS232, 51_PPI, 51_PPI_40, 51_PPO, 51_PPO_40, PPO2_CN3, 51_RTC, 51_RTC_40, 51_TER, 51_TER_40,

   EXAMPLEs

BASCOM - 8051

 For GPC® F2 + K51-AVR Boards

 

 GPC® F2

F2_AD4, F2_DA, F2_REE, F2_WEE, F2_PPI, F2_PPO, F2_RTC, F2_TER

  EXAMPLEs

BASCOM - 8051

 For K51-AVR + KND 08 Boards

For K51-AVR + KND 44 Boards

For K51-AVR + KAD 08 Boards

 

KND_08 - KND_44 - KAD_08

 KND_08, KND_44, KAD_08, KAD_08_2

  EXAMPLEs

BASCOM - 8051

 For GPC® F2 + KND 08 Boards

For GPC® F2 + KND 44 Boards

For GPC® F2 + KAD 08 Boards

 

 GPC® F2

F2_KND_08, F2_KND_44, F2_KAD_08, F2_KND_08_2


 EXAMPLEs

BASCOM - AVR

 For K51-AVR Boards

  

  K51-AVR

DEMO_AD11, DEMO_AD4, DEMO_DA, DEMO_REE, DEMO_WEE, DEMO_LCD, LCD_2, DEMO_PPI, DEMO_PPO1, DEMO_PPO2, DEMO_RTC, DEMO_TER

 EXAMPLEs

BASCOM - AVR

 For K51-AVR + KND 08 Boards

For K51-AVR + KND 44 Boards

For K51-AVR + KAD 08 Boards

  KND_08 - KND_44 - KAD_08

KND_08, KND_44, KAD_08, KAD_08_2


 EXAMPLEs

µC/51

 For K51-AVR Boards

 

   K51-AVR for 89C51

C51_AD11, C51_AD4, C51_DA, C51_LCD, C51_LCD2, C51_PPI, C51_PPO, C51_PPO2, C51_REE, C51_RS232, C51_RTC, C51_TER, C51_WEE,

 K51-AVR for 89C4051

C40_AD11, C40_AD4, C40_DA, C40_PPI, C40_PPO, C40_REE, C40_RS232, C40_RTC, C40_TER, C40_WEE,

 EXAMPLEs

µC/51

 For K51-AVR + KND 08 Boards

For K51-AVR + KND 44 Boards

For K51-AVR + KAD 08 Boards

 ( KND_08 - KND_44 - KAD_08 ) for 89C51

KND_08, KND_44, KAD_08, KAD_08_2

 ( KND_08 - KND_44 - KAD_08 ) for 89C4051

KND_08, KND_44, KAD_08, KAD_08_2


Page up-dated at October 06, 2003


homeHome Categorical Index CPU Tables Data. S. Examples Prog.             Articles