Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Mar 9th, 2005, 4:02 PM   #11
Christian_Rosenkreuz_777
Newbie
 
Join Date: Feb 2005
Location: Charlottesville, VA (rated #1 place to live)
Posts: 25
Rep Power: 0 Christian_Rosenkreuz_777 is on a distinguished road
Oh yeah, one more thing. I read (and my friend assures me) that binary instructs the processor to open and close circuits. Is this true?
__________________
Cavear Emptor
Christian_Rosenkreuz_777 is offline   Reply With Quote
Old Mar 10th, 2005, 3:35 PM   #12
brkstf
Programmer
 
brkstf's Avatar
 
Join Date: Feb 2005
Posts: 89
Rep Power: 4 brkstf is on a distinguished road
that's exactly what it does.

you should try doing some microcontroller assembly for PIC or 8051 or something, and you would see EXACTLY what goes on.

basically, there are several levels of logic. feel free anyone to correct me, but your standard microprocessor flips switches and reads inputs in the 2.5 volts range. microcontrollers tend to work in the 5V range. various other ICS, like FETs, etc, work in other voltage ranges.

look online for circuit diagrams of the NOT, OR, XOR, and AND circuits, and you will begin to understand exactly what's going on.
brkstf is offline   Reply With Quote
Old Mar 11th, 2005, 4:10 PM   #13
Christian_Rosenkreuz_777
Newbie
 
Join Date: Feb 2005
Location: Charlottesville, VA (rated #1 place to live)
Posts: 25
Rep Power: 0 Christian_Rosenkreuz_777 is on a distinguished road
What's microcontroller assembly?
__________________
Cavear Emptor
Christian_Rosenkreuz_777 is offline   Reply With Quote
Old Mar 11th, 2005, 4:48 PM   #14
Christian_Rosenkreuz_777
Newbie
 
Join Date: Feb 2005
Location: Charlottesville, VA (rated #1 place to live)
Posts: 25
Rep Power: 0 Christian_Rosenkreuz_777 is on a distinguished road
Quote:
how would you write a program in binary?
The opcodes can be found freely on the internet for most microprocessors, so if you code assembly, there's a one-to-one correspondence. When I code it, I write it in lines of 16 bytes each (a byte is 8 bits, a bit is a one or zero). Hex is a base-16 number system, and a search for "Hex Programming" will give you tutorials on what it looks like. Basically, one Hex number corresbonds to one nibble in binary (a nibble is 4 bits), so there are two hex digits per byte. If you want to, you can write a program in BASIC that saves programs in hexadecimal and converts them to binary, saving the result as .COM (.COM means the stack is defined by the operating system, and it has to be under 64 kilobytes. It's much simpler, and was common with the CP/M operating system, as it's just straight machine language). Here's a "Hello, world!" program in binary. You can edit it with notepad or whatever, and save the result as "hello.exe"(yes, it's .exe as I added my own stack) (keep the quotes if you use notepad). Execute it in DOS.

01001101010110100001111100000000000000100000000000000001000000000010000000000000010000010000000011111111111111110000001000000000
00000000000001000000000000000000000000000000000000000000000000000010001000000000000000000000000000000001000000001111101100100000 
01110010011010100000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
As you can see, it's a rather complicated procedure. All of those zeroes are the stack. If I'd generated a .COM file, those would be gone. In fact, you can experiment deleting those zeroes and saving it as .COM
Also, compare it's size to a program written in C, or BASIC!
BTW, those spaces aren't supposed to be there: they were inserted by the forum.
__________________
Cavear Emptor
Christian_Rosenkreuz_777 is offline   Reply With Quote
Old Mar 11th, 2005, 4:59 PM   #15
brkstf
Programmer
 
brkstf's Avatar
 
Join Date: Feb 2005
Posts: 89
Rep Power: 4 brkstf is on a distinguished road
Quote:
Originally Posted by Christian_Rosenkreuz_777
What's microcontroller assembly?
a microcontroller is a type of programmable IC that's a little more rugged, but a lot slower than what is commonly called a "microprocessor."

microcontrollers can handle current loads that are well over 10X what a processor can use, and can operate in the realm of 4-20 MHz.

messing around with one will show you how data really moves around your system.
brkstf is offline   Reply With Quote
Old Mar 12th, 2005, 10:31 AM   #16
Christian_Rosenkreuz_777
Newbie
 
Join Date: Feb 2005
Location: Charlottesville, VA (rated #1 place to live)
Posts: 25
Rep Power: 0 Christian_Rosenkreuz_777 is on a distinguished road
Thanks brkstf!
__________________
Cavear Emptor
Christian_Rosenkreuz_777 is offline   Reply With Quote
Old Mar 12th, 2005, 10:36 AM   #17
Christian_Rosenkreuz_777
Newbie
 
Join Date: Feb 2005
Location: Charlottesville, VA (rated #1 place to live)
Posts: 25
Rep Power: 0 Christian_Rosenkreuz_777 is on a distinguished road
Quote:
it's execution speed isn't any different
Couldn't you adjust the size of the stack though? In assmembly, if you make a stack it follows a predetermined size, but in machine language you can adjust it to your need.
__________________
Cavear Emptor
Christian_Rosenkreuz_777 is offline   Reply With Quote
Old Mar 12th, 2005, 11:30 AM   #18
Xero
Hobbyist Programmer
 
Join Date: Dec 2004
Location: a cardboard box
Posts: 118
Rep Power: 4 Xero is on a distinguished road
Quote:
Originally Posted by brkstf
a microcontroller is a type of programmable IC that's a little more rugged, but a lot slower than what is commonly called a "microprocessor."

microcontrollers can handle current loads that are well over 10X what a processor can use, and can operate in the realm of 4-20 MHz.

messing around with one will show you how data really moves around your system.
A microcontroller is basically the same as a microprocessor, except it has other features specific to its needs. (i.e. additional memory and I/O devices)
__________________
...
Xero is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 1:07 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC