www.flickr.com

Zilog Microcontroller Programming 101

Tuesday, November 27, 2012 Posted by Glenn


ZILOG 101
PART 1

Prepared by: Posadas, Glenn Von C.

Visit www.glennvon.com for more tutorials


Language of this post: Tagalog & English.
If you find this and you do not understand Tagalog, wait for my full-english post. Just Subscribe to my blog.
Okay, so I was hesitating lately. Saan ba mas maganda? Sa Powerpoint o sa Word? Kasi kung sa Word ko ito ilalagay, pwede ko ito mailagay sa website ko.
Anyways, I won’t and I can’t teach you how to exactly install the basic drivers and IDEs necessary for the Zilog ha? Wala akong microcontroller module dito. I use arduino for my projects at sa 5th year ko pa yang Zilog. So baka sa summer na ako bumalik diyan.

HERE ARE THE THINGS YOU ARE REQUIRED TO DOWNLOAD AND INSTALL:

Basically, all programming ang maituturo ko ditto. So let us begin.
THE C PROGRAMMING LANGUAGE BASICS
I bet medyo naaalala nyo pa ang unang una nyong programming language na C.
Example program. This will compile and display: “I love you”. By the way, don’t waste your time by running it. Quotations here in MS Word may confuse the compiler.


#include                              
#include
Int main(void)
{
                printf(“I love you”);
                getch();
}

EXPLANATION:
Yung katabi ng mga nasa #include, yan yung tinatawag na headers. Kaya nga may .h na nakalagay. Basically #include is a function that will include files, such as your headers or your other files. Kunwari, #include “this_is_my_second_function.c”
Now, what is the difference between “ “ and < > ? The quotation tells the reader that these are your own files. < > indicates, on the other hand that the file is in the compiler itself.
The int main(void) { } is our main function. Later on, I will show you how to make your own function such as delay.

VARIABLES & VARIABLE DECLARATIONS
Variables are used to store different types of data. Kumbaga sa Assembly Low level Programming language, ito ay isang registers. Parang sa microprocessor. Anyway, there are two types of variables (there are the two ways of declaring your variables inside your program.
1.      GLOBAL VARIABLES
2.      LOCAL VARIABLES

Now, ano anman ang pinagkaiba nitong dalawang ito? Ewan ko. Joke.
Global Variables – ito yung mga variables na nasa taas ng ating mga mga functions. Usually nasa itaas ng main function. Pero ang pinakamabisang pageexplain kung pano masasabi na ang isang variable ay globally declared ay sa pamamagitan ng pagtingin kung ito ay nasa ilalim ng mga headers. Magulo ba? Tsss.
Local Variables – ito yung mga variables na nasa loob ng isang certain functions.
Note that all local variables are merely accessible inside your function where it is declared. While the global variable, on the other hand, can be accessed by any of your functions anytime.
So, hindi ko na ieexplain yung “;” at yung mga uri ng DATA TYPES ha? Pero sige, konti lang. “;” ito ay yung tinawag kong TERMINATOR noong 2nd year college ako na nauso naman sa buong klase at until now ginagamit ng mga kakalse ko. Hindi ko talaga alam kung ano ang official na tawag dyan sa programming, basta ang term ko dyan ay terminator.
EXAMPLES OF DATA TYPES: float, int, bool, etc…

MACRO DEFINITIONS
Let us go to macro function for awhile. I learned this one when I was in 2nd year ulit. Hehehe. Effective ito lalo na kapag may exam ka at gusto mong mauna magpacheck. XD. Ito ay gamit sa pagpapaikli at pagdeclare ng CONSTANTS.
Macros are defined by the #define directive
Examples:
//this allows NUMBER to represent 3
#define NUMBER 3
//this allows SHOW to represent the printf() instruction
#define SHOW printf(“Hello World!”);

Commonly used data types

char(8 bits)
 int (16 bits)
 float (32 bits)

Array – a group of elements having the same data type
Example: char string[100] – an array named “string”
composed of 101 characters (from string[0] to string[100])

Variable Declarations
Variables are declared by the data type and variable name

if you want to continue reading this, download this full pdf file:


additional tags: full tutorial in zilog, z8 encore full tutorial, tutorial 101 in zilog, zilog hyperterminal, 101 in zilog, z8 encore full tutorial, pdf for z8, z8 pdf, z8 ebook, ebook tutorial for zilog 101, zilog 101 full ebook tutorial




glenn von

Author: Glenn Posadas

20 year old 5th year Computer Engineering Student, a blogger, photographer, programmer, and an electronics hobbyist; a Christian who loves God very much..

Sharing is so Easy:
StumpleUpon DiggIt! Del.icio.us Blinklist Yahoo Furl Technorati Simpy Spurl Reddit Google Twitter FaceBook

Post a Comment

Drop a comment. Thank you guys!