Skip to Content
Embedded Programming with Modern C++ Cookbook
book

Embedded Programming with Modern C++ Cookbook

by Igor Viarheichyk
April 2020
Intermediate to advanced
412 pages
9h 58m
English
Packt Publishing
Content preview from Embedded Programming with Modern C++ Cookbook

How to do it...

Follow these steps to complete this recipe:

  1. Open mcu8051ide and create a new project.
  2. Create a new file called serial.c and copy the following code snippet into it. This code copies the bytes that were received over the serial link to the P0 output register. This is associated with the general-purpose input/output pins on the MCU:
#include<8051.h>void serial_isr() __interrupt(4) {     if(RI == 1) {        P0 = SBUF;        RI = 0;    } }void main() {    SCON = 0x50;    TMOD = 0x20;    TH1 = 0xFD;    TR1 = 1;     ES = 1;    EA = 1;    while(1); }
  1. Select Tools | Compile to build the code.
  2. Select the Simulator | Start/Shutdown menu entry to activate the simulator.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

C++ System Programming Cookbook

C++ System Programming Cookbook

Onorato Vaticone
C++ Cookbook

C++ Cookbook

D. Ryan Stephens, Christopher Diggins, Jonathan Turkanis, Jeff Cogswell

Publisher Resources

ISBN: 9781838821043Supplemental Content