Keil software programs

Program 1

 org 00h

ljmp main

org 8100h

main:

mov a,#55

mov a,55h

mov a,r0

mov a,@r0

here:sjmp here


Program 2

org 00h

ljmp main

org 8100h

main:

MOV A,#55H ;load A with value 55H

MOV 40H,A ;copy A to RAM location 40H

MOV 41H,A ;copy A to RAM location 41H

  MOV 42H,A  

xx: SJMP xx


Program 3

org 00h

ljmp main

org 8100h

main:

MOV A,#55H ;load A with value 55H

MOV R0,#40H ;load the pointer. R0=40H

MOV @R0,A ;copy A to RAM R0 points to

INC R0 ;increment pointer. Now R0=41h

MOV @R0,A ;copy A to RAM R0 points to  

xx: SJMP xx


Program 4 - LED Blink 

org 00h

ljmp main

org 8100h

main:

MOV A,#55H ;load A with value 55H

back: MOV P1,A

ACALL DELAY

CPL A

ACALL DELAY

SJMP BACK

DELAY: MOV R0,#0FFH

MOV R1,#0FFH

MOV R2,#0FFH

L1: DJNZ R0,L1

L2: DJNZ R1,L2

L3: DJNZ R2,L3

RET

Program 5- Port data transfer

org 00h
ljmp main
org 8100h
main:
MOV A,#0FFH ;load A with value FFH
MOV P1,A
back: MOV A,P1
MOV P2,A
SJMP BACK

Program 6- LED_ON_OFF using embedded C

#include <reg51.h>
#defind LED P2;

void main(void)
{
P1=00; //clear P1
P2=0; //clear P2
for (;;) //repeat forever
{
P1++; //increment P1
P2++; //increment P2
}

}


Program 7- Time dealy using Timer

MOV TMOD,#01 ;Timer 0, mode 1(16-bit mode)

HERE: MOV TL0,#0F2H ;TL0=F2H, the low byte
MOV TH0,#0FFH ;TH0=FFH, the high byte
CPL P1.5 ;toggle P1.5
            ACALL DELAY
SJMP HERE

DELAY:
SETB TR0 ;start the timer 0
AGAIN: JNB TF0,AGAIN ;monitor timer flag 0
;until it rolls over

CLR TR0 ;stop timer 0
CLR TF0 ;clear timer 0 flag
RET




Real time temperature analysis using Node MCU, Things speak, Arduino IDE, LM35

 #include "ThingSpeak.h"

#include <ESP8266WiFi.h>
const int LM35 = A0;
//----------- Enter you Wi-Fi Details---------//
char ssid[] = "Your WIFI name"; //SSID
char pass[] = "Your WIFI password"; // Password
//-------------------------------------------//

WiFiClient  client;

unsigned long myChannelNumber = 2330518; // Channel ID here
const int FieldNumber = 1;
const char * myWriteAPIKey = "UGPA60UT6W30KA3E"; // Your Write API Key here

void setup()
{
  Serial.begin(115200);
  WiFi.mode(WIFI_STA);
  ThingSpeak.begin(client);
}
void loop()
{
  if (WiFi.status() != WL_CONNECTED)
  {
    Serial.print("Attempting to connect to SSID: ");
    Serial.println(ssid);
    while (WiFi.status() != WL_CONNECTED)
    {
      WiFi.begin(ssid, pass);
      Serial.print(".");
      delay(5000);
    }
    Serial.println("\nConnected.");
  }
  int ADC;
  float temp;
  ADC = analogRead(LM35);  /* Read Temperature */
  temp = (ADC * 3); /* Convert adc value to equivalent voltage */
  temp = (temp / 10); /* LM35 gives output of 10mv/°C */
  Serial.print("Temperature = ");
  Serial.print(temp);
  Serial.println(" *C");
  delay(1000);
  ThingSpeak.writeField(myChannelNumber, FieldNumber, temp, myWriteAPIKey);
  delay(1000);
}

Connecting Node MCU to WIFI using mobile hotspot

#include <ESP8266WiFi.h> // Include the Wi-Fi library
const char* ssid = "Your wifi name"; // The SSID (name) of the Wi-Fi network you want to connect to
const char* password = "Your wifi password"; // The password of the Wi-Fi network

void setup() {

Serial.begin(115200); // Start the Serial communication to send messages to the computer
delay(10);
Serial.println('\n');

WiFi.begin(ssid, password); // Connect to the network
Serial.print("Connecting to ");
Serial.print(ssid); Serial.println(" ...");

int i = 0;
while (WiFi.status() != WL_CONNECTED) { // Wait for the Wi-Fi to connect
delay(1000);
Serial.print(++i); Serial.print(' ');
}

Serial.println('\n');
Serial.println("Connection established!");
Serial.print("IP address:\t");
Serial.println(WiFi.localIP()); // Send the IP address of the ESP8266 to the computer

}
void loop() { }