Alldatasheet,Compilers

Tricks,Techniques With Microcontrollers/Embeddedcontrollers,Datasheets of peripherals,Programming Environment

Advantage of the Sysnchronous communication over Asynchronous commnication

Posted by alldatasheet on September 10, 2007

Advantage of the Sysnchronous communication over Asynchronous commnication:

Band width:
Synchronous comm. utilieses the BW more efficiently than than of asyncrhonous comm.
It wil carry information(data) close to 56000/8= 7000 bytes per second
while asynchronous is close to 56000/10=5600 bits per seconds.

Another advatnage is that frame strcuture allows easy handling of control information.
its contains it normaly on ist byte.

Posted in Tricks, Tutorial | Leave a Comment »

RS232, RS422 and V.35 Interfaces

Posted by alldatasheet on September 10, 2007

RS232, RS422 and V.35 Interfaces

For The Site Hosted this Matter Click here

RS-232

RS-232 has been around as a standard for decades as an electrical interface between Data Terminal Equipment (DTE) and Data Circuit-Terminating Equipment (DCE) such as modems or DSUs. It appears under different incarnations such as RS-232C, RS-232D, V.24, V.28 or V.10 but essentially all these interfaces are interoperable. RS-232 is used for asynchronous data transfer as well as synchronous links such as SDLC, HDLC, Frame Relay and X.25

There is a standardized pinout for RS-232 on a DB25 connector, as shown below.

RS232 diagram

The essential feature of RS-232 is that the signals are carried as single voltages referred to a common earth on pin 7.

Data is transmitted and received on pins 2 and 3 respectively. Data set ready (DSR) is an indication from the Dataset (i.e., the modem or DSU/CSU) that it is on. Similarly, DTR indicates to the Dataset that the DTE is on. Data Carrier Detect (DCD) indicates that carrier for the transmit data is on.

Pins 4 and 5 carry the RTS and CTS signals. In most situations, RTS and CTS are constantly on throughout the communication session. However where the DTE is connected to a multipoint line, RTS is used to turn carrier on the modem on and off. On a multipoint line, it is imperative that only one station is transmitting at a time. When a station wants to transmit, it raises RTS. The modem turns on carrier, typically waits a few milliseconds for carrier to stabilize, and raises CTS. The DTE transmits when it sees CTS up. When the station has finished its transmission, it drops RTS and the modem drops CTS and carrier together. This is explained further in our tutorial on the SDLC protocol, which uses multipoint lines extensively.

The clock signals are only used for synchronous communications. The modem or DSU extracts the clock from the data stream and provides a steady clock signal to the DTE. Note that the transmit and receive clock signals do not have to be the same, or even at the same baud rate. The auxiliary clock signal on pin 24 is supplied on boards built by Sangoma in order to allow local connections without the need for a modem eliminator. The baud rate of the auxiliary clock is programmable. By jumpering this signal to pins 15 and 17 on each side, you can use a simple null-modem cable for synchronous connections. This arrangement is much less expensive than using Modem Eliminator boxes to provide the cable crossover and clocking.

 


The truth table for RS232 is:

Signal > +3v = 0

Signal < -3v = 1 <-3v>

The output signal level usually swings between +12v and -12v. The “dead area” between +3v and -3v is designed to absorb line noise. In the various RS-232-like definitions this dead area may vary. For instance, the definition for V.10 has a dead area from +0.3v to -0.3v. Many receivers designed for RS-232 are sensitive to differentials of 1 volt or less.

 


RS-232 is simple, universal, well understood and supported everywhere. However, it has some serious shortcomings as an electrical interface.

First, the interface presupposes a common ground between the DTE and DCE. This is a reasonable assumption where a short cable connects a DTE and DCE in the same room, but with longer lines and connections between devices that may be on different electrical buses, this may not be true. We have seen some spectacular electrical events causes by “uncommon grounds”.

Second, a signal on a single line is impossible to screen effectively for noise. By screening the entire cable one can reduce the influence of outside noise, but internally generated noise remains a problem. As the baud rate and line length increase, the effect of capacitance between the cables introduces serious crosstalk until a point is reached where the data itself is unreadable.

Crosstalk can be reduced by using low capacitance cable. Also, as it is the higher frequencies that are the problem, control of slew rate in the signal (i.e., making the signal more rounded, rather than square) also decreases the crosstalk. The original specifications for RS-232 had no specification for maximum slew rate.

 


The standards for RS-232 and similar interfaces usually restrict RS-232 to 20kbps or less and line lengths of 15m (50 ft) or less. These restrictions are mostly throwbacks to the days when 20kbps was considered a very high line speed, and cables were thick, with high capacitance.

However, in practice, RS-232 is far more robust than the traditional specified limits of 20kbps over a 15m line would imply. Most 56kbps DSUs are supplied with both V.35 and RS-232 ports because RS-232 is perfectly adequate at speeds up to 200kbps. You may remember the “zero slot LANs” that were popular a few years ago, using RS-232 ports on PCs running at 115kbps. At Sangoma we have successfully used RS-232 (albeit on short cables) at line speeds of over 1.6Mbps.

Interestingly enough, most RS-232 ports on mainframes and midrange computers are capable of far higher speeds than their rated 19.2kbps. Usually these “low speed” ports will run error-free at 56kbps and above.

The 15m limitation for cable length can be stretched to about 30m for ordinary cable, if well screened and grounded, and about 100m if the cable is low capacitance as well. Our standard test cable at Sangoma is an interconnected run of round and flat cable, about 25M in length, with no screening at all. We run error-free on this cabling collection at up to 112kbps.

 


S-422, RS-485, V.11 and other balanced interfaces.

The limitations of RS-232 are largely eliminated by the balanced line interface.

A pair of wires is used to carry each signal. The data is encoded and decoded as a differential voltage between the two lines. A typical truth table for a balanced interface is as follows:

VA-VB < -0.2v =0

VA-VB > +0.2v=1

As a differential voltage, in principle the interface is unaffected by differences in ground voltage between sender and receiver.

Furthermore, if lines A and B are close together, they will be affected almost identically by external electromagnetic noise. If the lines are also twisted together, then neither line is permanently closer to a noise source than the other. Hence the well known “twisted pair” is extremely effective in eliminating noise from the signal.

 


Balanced systems are used by LAN topologies like Ethernet and Token Ring. They can support line speeds over 100Mbps and work reliably at distances of several kilometers.

There are several standards that incorporate balanced line signals into DB connectors. These include RS-449 (DB37), X.21 (DB15) and RS530 (DB25). The threshold voltages in the truth table are not identical for these standards, but the standards are usually interoperable.

As line speeds and lengths go up, the problem of signal reflections becomes important. Lines must be properly terminated by a resistor that makes the cable look electrically like it is infinitely long (an infinitely long cable, of course, can have no reflected signals because the far end is infinitely far away). These terminating resistor values depend on the geometry of the cable itself. So you will see cable designated as 75 Ohm cable or 50 ohm cable, etc. What this means is that by installing a 50 ohm resistor, say, between the signal pair, this particular type of cable will have the electrical characteristics of an infinitely long cable. Note that the designation “50 ohm cable” has nothing to do with the electrical impedance of the physical cable itself.

In theory, extraneous noise, input equally on each line of a pair has no effect. In practice, however, the characteristics of the receivers are such that sufficiently high noise levels cause one side of the receiver to saturate, leading to data errors. Resistor networks are frequently included that provide low resistance paths to earth to dissipate noise.

Sangoma cards, such as the S5148 used for WANPIPE®, generally include the correct terminations on the boards themselves.

 


V.35 Interface

The V.35 interface was originally specified by CCITT as an interface for 48kbps line transmissions. It has been adopted for all line speeds above 20kbps, and seems to have acquired a life of its own. It was discontinued by CCITT in 1988, and replaced by recommendations V.10 and V.11.

V.35 is a mixture of balanced (like RS422) and common earth (like RS232) signal interfaces. The control lines including — DTR, DSR. DCD, RTS and CTS — are single wire common earth interfaces, functionally compatible with RS-232 level signals. The data and clock signals are balanced, RS-422-like signals.

The control signals in V.35 are common earth single wire interfaces because these signal levels are mostly constant or vary at low frequencies. The high-frequency data and clock signals are carried by balanced lines. Thus single wires are used for the low frequencies for which they are adequate, while balanced pairs are used for the high-frequency data and clock signals.

The V.35 plug is standard. It is a black plastic plug about 20mm by 70mm, often with gold-plated contacts and built-in hold down and mating screws. The V.35 plug is roughly 30 times the price of a DB25, making everything to do with V.35 somewhat expensive.

 


If your DSU supports RS-232 as well as V.35 you are always better off financially using the RS-232 option. An additional complication with V.35 is that the V.35 plug is too large to fit on many add-in cards, such as those used by PCs. Thus there is very often a non standard cable used to connect a V.35 system, terminating in a DB25 at one end and a V.35 plug at the other. It is very easy to use the wrong cable, and quite difficult to debug if you do.

Debugging any balanced signal is quite tricky. Identification of the “A” and “B” halves of a signal pair is difficult. It is very easy to switch the polarity of the signals on a signal pair. Under certain circumstances, such an interface will appear to be working correctly, except for odd line errors at certain times.

Standard pinouts of the cables used for Sangoma cards are published on the web.

 

Posted in Datasheets, Peripherals, Tricks, Tutorial | Leave a Comment »

The FAQs of Life About G.703

Posted by alldatasheet on September 5, 2007

I was searching for G.703, To Know what exactly it is ? now I found the answer

click here to see it or go through the matter below

Questions and Answers Regarding 2.048 Mbps G.703

 

  • Talk to five “datacom types” about G.703 communication and you’re likely to
  • recall the fable about five blind men describing an elephant (the one holding its
  • trunk thinks it’s like a snake, the one holding its leg thinks it resembles a tree,
  • etc.). Only in this story the description might change based upon the country or
  • the PTT involved. Here are some frequently asked questions about G.703 and
  • some answers-at least from our perspective-that may help to clarify things a bit.
  • I’ve never heard of G.703; is it the same as E1?
  • That’s like asking if IEEE 802.3 is the same as Ethernet. The first term is very
  • specific and technical, the second is a general umbrella category. Like 802.3,
  • CCITT/ITU Recommendation G.703 is a specific standard covering physical and
  • electrical characteristics of a digital interface. In the case of G.703, it presents a
  • standard method for encoding clock and data into a single signal. The principles
  • in G.703 are applicable to interfaces with data rates ranging from 64 kbps to
  • 2.048 Mbps. The Patton Model 2703 G.703 digital modem is designed for 2.048
  • Mbps networks.
  • A.
  • Who provides G.703 service and how would I use it? Q.
  • Your carrier would provide you with a point-to-point link that is
  • “unstructured”, meaning that you must supply the timing (“structured” service is
  • called G.704). You would use your G.703 link for interconnecting data
  • communications equipment, such as bridges, routers, and multiplexers at a data
  • rate of 2.048 Mbps.
  • A.
  • What if my equipment runs slower than 2.048 Mbps; can I use just a fraction
  • of the bandwidth?
  • Q.
  • Normally, with unstructured G.703 service, the answer is “no”. However, the
  • Patton Model 2703 provides a rate adaptation function that lets you connect
  • equipment running at 256 Kbps, 512 Kbps or 1.024 Mbps to a 2.048 Mbps G.703
  • network. Without a rate adapting digital modem you would need structured
  • G.704 service, which can be supplied in 64 Kbps increments. Structured G.704
  • service may or may not be available from your carrier.
  • A.
  • Since G.703 requires that the user supply the timing (rather than the carrier),
  • how is this accomplished?
  • Q.
  • In most cases, the user equipment at one end of the line is set up as a clock
  • master and the equipment at the other end is set up as a slave. This is
  • particularly important when the DTE interface is X.21 (which only has a single
  • clock signal), as both directions of the G.703 link signal must use the same
  • timing. If the DTE equipment has two clock signals, as is the case with EIA-530,
  • then both ends can be set up as clock master.
  • A.
  • So the DTE equipment at either end provides the timing? Q.
  • Actually, regulatory requirements usually prohibit the use of clocks originating A.
  • from the DTE. Therefore, the clock must be supplied by the G.703 termination
  • equipment (DCE) to which the DTE is connected. The Patton Model 2703 can be
  • set up as either master or slave, and can accommodate X.21, EIA-530 (RS-422)
  • and V.35 DTE interfaces.
  • If I order G.703 service from a particular carrier, what type of termination will
  • it require?
  • Q.
  • Depending upon your geographic location and the carrier supplying the
  • service, termination will either be balanced (120 ohm) or unbalanced (75 ohm).
  • Balanced termination can be presented on a single DB-15 or RJ-45 connector.
  • Unbalanced termination is presented on a pair of BNC connectors. Generally
  • speaking, 75 ohm termination is more prevalent in the UK and Netherlands.
  • Everywhere else that G.703 is offered, 120 ohm termination is the rule. And in
  • fact, the new Open Network Provision standard of the EEC requires that 120
  • ohm termination be available throughout Europe-even in countries now
  • standardized on 75 ohm.
  • A.
  • Fortunately, the Patton Model 2703 comes equipped with both 75 ohm (dual
  • BNCs) and 120 ohm (RJ-45 jack) network termination interfaces. If you are using
  • another G.703 modem, you might find the little Patton Model 460 G.703 balun a
  • handy solution for matching 120 ohm to 75 ohm (and vice versa), both physically
  • and electrically.
  • What is the difference between G.703 and G.704? Q.
  • G.704 (along with G.732) specifies a framing structure that can be
  • superimposed on a G.703 signal. The unstructured G.703 signal is comprised of
  • 32 time slots of 64Kbps (32 x 64Kbps = 2.048Mbps). Time slot zero (TS0) is used
  • for synchronization. Since the carrier provides no timing, all 32 time slots (2.048
  • Mbps) are available to the DTE for data. However, G.704 is a structured service,
  • so the carrier “steals” the 64Kbps in TS0 to provide timing. Therefore, only 31
  • time slots (1.984 Kbps) are available to the DTE for data when G.704 service is
  • provided.
  • A.
  • How do I decide whether to use G.703 or G.704 service? Q.
  • The carrier usually makes this choice for you based upon their infrastructure.
  • If their infrastructure is cross-connect based, they will offer G.704 service. If
  • their infrastructure is multiplexer based, they will offer G.703 service. The Patton
  • Model 2703 is designed to work with G.703 networks. Patton will soon be
  • releasing G.704 products .

Posted in Datasheets, Tricks, Tutorial, Uncategorized | Leave a Comment »

Final Year Project: PBX(Private Branch Exchange)

Posted by alldatasheet on August 27, 2007

If you are in B.tech(ECE) Final year student You have to made your project, so you might be thinking what is better to try with ,if you have a bit of interest in Microprocessor /Microcontroller programming then go for it try make your own PBX, it will make your undr standing very sound with the your core …….. so try it right now.. if you need help i m here for you..

Requiered component: DTMF receiver : Reqired to sense dialing :It receives the tone from phone(single line telephone) & converts it to BCD numbers, which is used by MCU to decide to whom he call , here the IC nuber is 8870 ,9170 here the pin number 15 of ic Is caled STd pin it becomes high ig valid tone is sensed , accordingly the software performs required functions.

switching matrix:

cntd…..

Click here to get Final year project PBX(harware & software)

Program design & issues: Link for the state machines

Receiver side state machine

sender1 side state diagram

sender2 side state diagram

sorce code for PBX 

Posted in Projects | Leave a Comment »

Tryst With Embedded Systems:Writing Code

Posted by alldatasheet on August 27, 2007

Tryst with embedded system:

If you wan to write code for ebedded system the you have to take care of interrupt Type.
What do you want

1.Polling based sotware.
2.Interrupt based software.

What Is Iterrupt Service Routine (ISR)
The routine which can interrupts the main: main Stops all executions and save its Program counter
and other ALu registers on stack and then executes the Code (Which may be Vectored or nonvectored) ]
this code is called ISR because it excute when main intrrupted.

Vectored Interrupt:
Address of ISR to executes is given by the controller, it is fixed, Depending o kin of interrupt the
address given to MCU.

Nonvector Inrerrupt:
On generaton of interrupt the address of ISR is provided :as an acknowledgement ignal processed data bus start floaing
with the address.MCU reads adress and process the routine.

what is polling :
Polling is basically an interrupt which interrupts the system after a fixed time period.
check the status of all port aasigned.

what is interupt:
MCU contains m interrut type external/internal which interrupts to the system on some
spcific conditions like pick up your phone Connected to PBX mat trigger an inerrupt which will be
served on defind priorty basis.

Which one is better to use :
It simply depends on reqirment of the system and programers will.
but normally systems uses the polling,other interrupts can be made functional if extension of system
required. you can only make only interrupt based system which require more cautio about events in system

Some thing about main:
As you must have had a main if you want to write any code which will be executable.
so if you are are writin embedded Systm code the in that case at last write a infinite loop
to Ex:
While(1)
{};
You make check some condition insde loop, can cal some function again and again.
Now we move to an Example code This code is written for PBX ystem taken from

Posted in Compilers, Controllers, Tutorial | Leave a Comment »

C Interview question & answers

Posted by alldatasheet on August 25, 2007

A reader submitted the interview questions he was asked. More C/C++ questions will be added here, as people keep sending us a set of 2-3 questions they got on their job itnerview.

Q1: Tell how to check whether a linked list is circular.

A: Create two pointers, each set to the start of the list. Update each as follows:

while (pointer1) {
 pointer1 = pointer1->next;
 pointer2 = pointer2->next; if (pointer2) pointer2=pointer2->next;
 if (pointer1 == pointer2) {
   print ("circularn");
 }
}

Q2: OK, why does this work?

If a list is circular, at some point pointer2 will wrap around and be either at the item just before pointer1, or the item before that. Either way, it’s either 1 or 2 jumps until they meet.

How can you quickly find the number of elements stored in a a) static array b) dynamic array ?

Why is it difficult to store linked list in an array?

How can you find the nodes with repetetive data in a linked list?

Write a prog to accept a given string in any order and flash error if any of the character is different. For example : If abc is the input then abc, bca, cba, cab bac are acceptable but aac or bcd are unacceptable.

This is a C question that I had for an intern position at Microsoft: Write out a function that prints out all the permutations of a string. For example, abc would give you abc, acb, bac, bca, cab, cba. You can assume that all the characters will be unique. After I wrote out my function, he asked me to figure out from the code how many times the printf statement is run, and also questions on optimizing my algorithm.

What’s the output of the following program? Why?

#include <stdio.h>
main()
{
     typedef union
     {
         int a;
         char b[10];
         float c;
     }
     Union;
 
     Union x,y = {100};
     x.a = 50;
     strcpy(x.b,"hello");
     x.c = 21.50;
 
     printf("Union x : %d %s %f n",x.a,x.b,x.c );
     printf("Union y :%d %s%f n",y.a,y.b,y.c);
}

Given inputs X, Y, Z and operations | and & (meaning bitwise OR and AND, respectively)

What is output equal to in

output = (X & Y) | (X & Z) | (Y & Z)

59 Comments

1.    i think this will work for
while(node)
{
If(node==start)
printf(”circular”);
node=node->next;
}

2.    Chinmaya,
Your solution works only if loop begins at first element. But original solution works for all cases.

3.    this is a very useful site for freshers like me and who are willing to gain more knowledge. i have many other ideas which will help this site to comeup

if u can give a chance i will tell i m frm hyderabad

4.    How about those codes:

node = start->next;
while(node)
{
if(node == start)
{
printf(”circular”);
return;
}
node = node->next;
}

5.    The posted solution is flawed in that it can (and usually will) seg-fault on non-circular lists. A correct solution should have a “not circular” result as well.

 

6.    how can u find no of elements in an array quickly?

if it is a dynamic array(linked list) the tradition is to keep the count variable in the head
and incrementing it everytime an insertion is performed and decrementing whenever a deletion is performed.so by seeing that count vaiable we can easily tell no. of elements.

7.    Write a prog to accept a given string in any order and flash error if any of the character is different. For example : If abc is the input then abc, bca, cba, cab bac are acceptable but aac or bcd are unacceptable.
program
**************************************************

#define true 1
#define false 0
int* isalreadyread; /* this array is used to make sure that
int main(void) the characters in the original,which r matched with a char
{ in the dup is marked as ‘already read’*/
char* original; /* this string holds the original string like..abc*/
char* dup; /* this string is used to hold the duplicates like acb bac cab cba…*/
int isokay(char* ,char* ); /* this is the function(which intern calls many) which checks whether the string is okay*/
int origlength;
int flag;
void initilaizing_isalreadyread();
printf(”\n enter the original string”);
scanf(”%s”,original);
origlength=strlen(original);
isalreadyread=(int*) calloc(origlength,sizeof(int));
flag=true;
while(flag)
{
printf(”enter the duplicate string”);scanf(”%s”,dup);
initializing_isread(origlength);
flag=isokay(original,dup);
if(flag)
printf(”%s”,dup);
}
} /* end of main*/
int isokay(char* original,char* dup)
{
int reflength=strlen(original);
int duplength=strlen(dup);
int found(char c,char* str);
if(reflength!=duplength)
return false; /* this is obvious*/
for(int i=0;i

8.    Write out a function that prints out all the permutations of a string.
For example, abc would give you abc, acb, bac, bca, cab, cba.

It can be observed that the number of combinations of string, of length N,
is N!. Consider an example:

string: 123
Length: 3
Combination: 3! = 6
Output: 123 132 321 312 231 213

Following is a program to print all the combination a string:

1 /*
2 * str_combi.c – Print all the combinations of a string
3 * Author – Vijay Kumar R Zanvar
4 * Date – Feb 16, 2004
5 */
6
7 #include
8 #include
9 #include
10
11 void
12 string_combi ( char * s, int len )
13 {
14 int i;
15 char tmp;
16 static int j;
17 static char *p;
18
19 if ( !p )
20 p = s;
21
22 for ( i = 1; i 2 )
25 string_combi ( s+1, len-1 );
26 else
27 {
28 j++;
29 printf ( “%d: %s\t”, j, p );
30 if ( !( j%10 ) )
31 puts ( “” );
32 }
33 if ( i

9.    The was some problem during the upload of comment 8 above.
See a program to print combination of strings here:

10.                       chinmaya,
ur condition within the while loop is never going to be false if it is a circular
linked list. a break is needed.

11.                       Got a question that extends on the detecting circular linked list question:
Given the constraints that you cannot modify the struct (or class) of the elements, and that you have to remove the loop in the cyclic linked list in O(n) time and O(1) space, how would you do it?
By removing the loop, I mean something like:
_______________________________
__ __ __ _| __ __ __ _|
| | -> | | -> | | -> | | -> | | -> | | -> | | -> | |
— — — — — — — –

Given this linked list, how do you make the last element in the list to point to NULL in O(n) time and O(1) space?

I couldn’t think of a solution that uses O(1) space without modifying the structure. If I was allowed, I could just have a visited flag inside the struct. I’ll then have 2 pointers, a current and a previous. For every node traversed by the current, I will set the flag to true, and each traversal, I will check whether that flag is set to true. If it is, then the previous pointer is the last element of the list, and I can just set the next to NULL. This will also be in O(n) time.

Any insights on this?

12.                       The picture of the linked list was kinda screwed up…
Anyway, that picture has 8 elements, with the last element pointing to the 4th element, thus making a loop in the list.

13.                       answer for finding that link list is circular is
int count=0;
while (node)
{
if(node == start && count != 0) {
printf(”Circular”);
exit(0);
}
p = node->next;
q = node->next;
if(node == start)
node->next = null;

14.                       answer for finding that link list is circular is
int count=0;
while (node)
{
if(node == start && count != 0) {
printf(”Circular”);
exit(0);
}
p = node->next;
q = node->next;
if(node == start)
node->next = null;
else
node->next = r;
p->next = node;
node = q;
r = p;
count = count + 3;
}

15.                       iscircular(Node* head) /* check whether a link list is circular */
{

/* assume that linklist has a header which keeps a count of no.
of nodes in the list */

Node* temp=head;

while(head->data–)

temp=temp->next;

if(temp->next=head->next)/*1st node actually is next node to head*/
return TRUE;

return FALSE;
}

16.                       constructor can be static or not?and why? in c++

17.                       Not to mention the glaring access-violation once pointer2 becomes NULL(though this error indicates ‘not circular’), the unnecessity of traversing pointer1(though doing so does not impact numof iterations), and the lack of terminating conditions(though still technically within the guidlines by only “checking for circular”), the solution is FLAWED in that it will print “Circular” for non-circular lists with 1 node!!! (when Pointer1 and Pointer2 are both NULL) I did think it was a kinda cool idea to weed out the non-circular lists in (num of Nodes)/2 iterations, but the extra traversal code i think outweighs any benefit.
My elegant solution, if i do say so myself:

//assert: list is not empty
for(node=head->next; node!=NULL && node!=head; node=node->next);

if(node==NULL) cout

18.                       oops, that last statement should read:

if(node==NULL) printf(”Non-circular”);
else printf(”Circular”);

19.                       dawid,
i dont think my code is lack of terminating condition. i have put while(head->data–)
but i should have copied that head->data into a temporary variable. it should look like

int temp1=head->data
while(temp1–)…………

i dont think it will print “circular” for all single node lists.
if the’next’ of the single node is the address of the node…it will print circular.
otherwise it will print “not circular”.

the idea is to get the address in the ‘next’ field of the last node(node which was inserted latest)
i dont think there is a better way than traversing to reach ‘last’ node.

And…in ur code u assumed that the ‘last’ node’s next point to the Head.
i think its not a good design. it ruins the whole list then.

20.                       Sorry karthikeyan, I should have been more clear: I was referring to the original solution (by default). It seems to have been torn up enough already, but i wanted to show off my fancy 1 line traversal.
However, in rebuttal:
-You’re fired! Mistaking an equality operator(==) with an assignment(=) is an offense punishable by death.
-Your solution is unintelligible with that mangled loop condition. However relying on a count of num of nodes makes your algorithm possibly unscalable to lists with dummy nodes, for example.
-A chain of pointers will either end in a NULL pointer(if programmed responsibly), or you’ll eventually be back where you started again. I don’t see how this testing ruins a list. Your point is noted, though, about a list with a dummy head that is bypassed around the circle (Like this: -0 ); but that doesn’t look like a circle to me, and I feel that head should point to the first node and any extra information should be stored in a wrapping class (because starting at the front of the list would mean dereferencing twice; silly if traversed many times each game loop, for example). However, to address that issue for those small standalone-pointers-as-lists, you would send the first ‘real’ node ( head->next ) to this function. It is not completely efficient in that there is no specific head to terminate at – you must traverse all the way back around to the given node, but it works for any list. My beautiful(concise) function, if i do say so myself:

bool isCircular(Node* node1)
{
if(node1==NULL) return false;
for(Node* node2=node1->next; node2!=NULL && node2!=node1; node2=node2->next);
return (node2!=NULL);
}

Regards, Dawid.

21.                       dawid,
ur code looks efficient

22.                       David, your code does not work in case the loop does not begin with the first element. For example:

A->B->C->D->C

I agree though that the question was “check that a linked list is circular” and not “check that a linked list contains a circle”.

23.                       int main(int argc, char* argv[])
{
//Write a prog to accept a given string in any order and flash error if any of
//the character is different. For example : If abc is the input then abc,
//bca, cba, cab bac are acceptable but aac or bcd are unacceptable.
//program

char code[100];
char ip[100];
int i,count,flag=0;
puts(”Enter the string:”);
scanf(”%s”,ip);
puts(”Enter the comparision string:”);
scanf(”%s”,code);
for(i=0;i

24.                       I executed the Program uploaded on site: as mentioned in ANS No: 9
But the string are repeated:
For Example following is the programs Output:

Enter String : 123
1: 123
2: 132
3: 231
4: 213
5: 123 (Repeated with 1:)
6: 132 (Repeated with 2:)
Press any key to continue.

The effort to write the program is apperiable. I am also trying to write a program for it.

 SMN

25.                       #include
#include
#include
#define MLS 5
typedef struct listnode *p_node;
typedef struct listnode node;
typedef struct listnode{
int data;
p_node link;
};
void print_list (p_node ptr);
void add(p_node*,p_node*,p_node);
int delet(p_node*);
p_node creat_node(void);
void main()
{
clrscr();
int opselect=0;
p_node node1,node2,node3,node4,node5;
printf(”============START=============”);
if(opselect!=99)
{
printf(” \n enter aselect node \n”);
printf(” \n 1 to add \n”);
printf(” \n 2 to delet \n”);
printf(” \n 3 to exit \n”);
if(opselect==1){ add(,); }
if(opselect==2){ delete(); }
if(opselect==3){ printf(” good by the exit “);}
}
node1=creat_node();
node2=creat_node();
node3=creat_node();
node4=creat_node();
node5=creat_node();
//********************//
node1->data=10;
node1->link=node2;
node2->data=11;
node2->link=node3;
node3->data=12;
node3->link=node4;
node4->data=13;
node4->link=node5;
node5->data=14;
node5->link=NULL;
//*******************//
}
//function creat node//
p_node creat_node(void)
{
p_node lptr;
lptr=(p_node)malloc(sizeof(node));
return(lptr);
}
//function add node//
void add(p_node*rear,p_node*front,int data_insert)
{
p_node temp;
temp=(p_node)malloc(sizeof(p_node));
if(is_full(temp)){ printf(”\n the memory is full \n”);
exit(1); }
temp->data=data_insert;
if(*lptr){
temp->link=node->link;
node->link=temp;
}
else{
temp->link=NULL;
*lptr=temp;
}
}
//function delet node//
void delet(p_node ,p_node trial,p_node)
{
*node=trial->link;
if(trial)
trial->link=trial->link->link;
else
*lptr=(*lptr)->link;
}
//function print nodes//
void print_link(p_node lptr)
{
printf(” \n the list contains: \n “);
while(lptr)
{
printf(” \n \t %d”,lptr->data);
lptr=lptr->link;
}
}

 mohammad

26.                       For printing out all permutations of a string.
Please tell me all ways I can optimize. Any thoughts on a non-recursive algorithm? My C/C++ isn’t very strong. Raised on Java.

void PrintPermu (char *sBegin, char* sRest)
{
int iLoop;
char cTmp;
char cFLetter[1];
char *sNewBegin;
char *sCur;
int iLen;
static int iCount;

iLen = strlen(sRest);

if (iLen == 2)
{
iCount++;
printf(”%d: %s%s\n”, iCount, sBegin, sRest);

iCount++;
printf(”%d: %s%c%c\n”, iCount, sBegin, sRest[1], sRest[0]);

return;
}
else if (iLen == 1)
{
iCount++;
printf(”%d: %s%s\n”, iCount, sBegin, sRest);
return;
}
else
{
// swap the first character of sRest with each of the remaining chars
// recursively call debug print

sCur = (char*)malloc(iLen);
sNewBegin = (char*)malloc(iLen);

for (iLoop = 0; iLoop

 Aditya

27.                       For printing out all permutations of a string.
Please tell me all ways I can optimize. Any thoughts on a non-recursive algorithm? My C/C++ isn’t very strong. Raised on Java.

void PrintPermu (char *sBegin, char* sRest)
{
int iLoop;
char cTmp;
char cFLetter[1];
char *sNewBegin;
char *sCur;
int iLen;
static int iCount;

iLen = strlen(sRest);

if (iLen == 2)
{
iCount++;
printf(”%d: %s%s\n”, iCount, sBegin, sRest);

iCount++;
printf(”%d: %s%c%c\n”, iCount, sBegin, sRest[1], sRest[0]);

return;
}
else if (iLen == 1)
{
iCount++;
printf(”%d: %s%s\n”, iCount, sBegin, sRest);
return;
}
else
{
// swap the first character of sRest with each of the remaining chars
// recursively call debug print

sCur = (char*)malloc(iLen);
sNewBegin = (char*)malloc(iLen);

for (iLoop = 0; iLoop lessthan iLen; iLoop ++)
{

strcpy(sCur, sRest);
strcpy(sNewBegin, sBegin);

cTmp = sCur[iLoop];
sCur[iLoop] = sCur[0];
sCur[0] = cTmp;

sprintf(cFLetter, “%c”, sCur[0]);
strcat(sNewBegin, cFLetter);
debugprint(sNewBegin, sCur+1);

}
}

}

void main()
{

char s[255];
char sIn[255];
printf(”\nEnter a string:”);
scanf(”%s%*c”,sIn);
memset(s,0,255);

PrintPermu(s, sIn);
}

28.                       What is the size of the empty class’s object?If it is 1byte why?
please help me.

29.                       Write out a function that prints out all the permutations of a string.
For example, abc would give you abc, acb, bac, bca, cab, cba

Another solution

#include
#include
#include
#include
using namespace std;

typedef set setchar;
char szPermutation[256];

void permutate(setchar charset, char* szPermute )
{
if (!charset.size())
{
cout > strPermutation;
cout

30.                       Write a prog to accept a given string in any order and flash error if any of the character is different. For example : If abc is the input then abc, bca, cba, cab bac are acceptable but aac or bcd are unacceptable.
program
**************************************************
Simply have an array of 256 elements. Each element of the array corresponds to one character and stores its count in the original string
**************************************************

#include

int* getCharCounts(char* str)
{
int* result = new int[256];
for(int i=0; i>str1;
cout>str2;

int* c1 = getCharCounts(str1);
int* c2 = getCharCounts(str2);

if(match(c1,c2)) cout

31.                       Code to print permutations of a string using Recursion
======================================================

int perm_count = 0;

void swap(char *s, int t, int p)
{
char tmp;
tmp = s[t];
s[t] = s[p];
s[p] = tmp;
}
void permute(char *s, int p, int n)
{
int i,j;

if (p > n)
{
printf(”%s\n”, s);
perm_count++;
return;
}

for (i=p; i

32.                       This website has a bug, doesnt publish the entire code. It
chops it to 256 characters !! Too bad

33.                       Difference Between C and C++? what is clases, Functions explain with suitable program. And please Explain pointer with program. Finally diffence between Structure and Union. Explain the Advantage and disadvantages with program. Sorry for this Question. Ok bye. god Bless you.

34.                       in Comment #30, why is the array created for 256 chars?

35.                       Write a prog to accept a given string in any order and flash error if any of the character is different. For example : If abc is the input then abc, bca, cba, cab bac are acceptable but aac or bcd are unacceptable.
program

For this problem i like to give my soln,
Parse the input string (abc)into equivalent numeric value and sum it. do the same for other inputs( cba,cab..). Those subsequent inputs having the repeated character ocurrence will not be equal to the original value, so it will flash’s error. Welcome more suggestions..

36.                       IsCirCular(Node *pHead)
{
bool bIsCircular = false;
Node *pNewHead = pHead;

while (pNewHead && !bIsCircular)
{
Node* pTemp = pNewHead->Next;
while(pTemp && !bIsCircular)
{
if (pTemp == pNewHead)
{
bIsCircular = true;
}
else
{
pTemp = pTemp->Next;
}
}

pNewHead = pNewHead->Next;
}

return bIsCircular;
}

37.                       here is a c code, if u run this code u vl get an outputas
0c&0.0000000, can any one explain the reason?
#include
main(0
{
int a=15;
float b=123.1265
printf(”%d%f”,b,a);
}

38.                       once more :)
I think this one is more simple and nice solution for finding all permutations

void process ( char * s, int len , int nCurPos )
{
static int counter = 1;

if( nCurPos != len-1 )
{
process(s, len, nCurPos + 1);

for( int i = nCurPos+1; i != len; ++i )
{
char tmp = s[nCurPos];
s[nCurPos] = s[i];
s[i] = tmp;

process(s, len, nCurPos + 1);

tmp = s[nCurPos];
s[nCurPos] = s[i];
s[i] = tmp;
}
}
else
{
printf(”%d. %s\n”, counter, s);
++counter;
}

return;
}

*NOTE – in both places I put != instead of “less then”, because I can’t figure out, how to put that sign here :)

int main()
{
char s[50];

printf ( “\n Enter String : ” );
scanf ( “%s%*c”, s );
process ( s, strlen ( s ) , 0);

return EXIT_SUCCESS;
}

 Even if the answer to question 1 had the seg fault fixed like thus

while (pointer1) {
pointer1 = pointer1->next;
if (pointer2) pointer2 = pointer2->next;
if (pointer2) pointer2 = pointer2->next;
if (pointer1 == pointer2) {
print (\”circular\n\”);
}
}

It still would not work. A non circular list would end up setting pointer1 = NULL at the top of the last iteration of the while loop. pointer2 would already have been NULL (just got there faster) thus
pointer1 == pointer2 ===> circular!!! but its not.

39.                       /*
This is a C question that I had for an intern position at Microsoft:

Write out a function that prints out all the permutations of a string.
For example, abc would give you abc, acb, bac, bca, cab, cba.

You can assume that all the characters will be unique.
After I wrote out my function, he asked me to figure out from the code
how many times the printf statement is run, and also questions on optimizing my algorithm.

I think this may be the fastest way for permutations. Please comment:
(this website cannot display “<(less than)”, so i use (”), (!=) and (>) to replace it.

*/

#include “stdio.h”
#include “string.h”
#include “malloc.h”

int num = 0;

void swap (char * input, int nIndexA, int nIndexB)
{
register char temp = input[nIndexA];
input[nIndexA] = input[nIndexB];
input[nIndexB] = temp;
}

void permutations(char * input, const int nLength, const int nBeginPosition)
{
if ( nLength > nBeginPosition+1 )
{
char * pTemp = (char *)malloc(nLength+1);
if ( pTemp == NULL )
return;

strcpy(pTemp, input);
permutations(pTemp, nLength, nBeginPosition+1);
for ( int i=nBeginPosition+1; i!=nLength; i++ )
{
strcpy(pTemp, input);
swap(pTemp, nBeginPosition, i);
permutations(pTemp, nLength, nBeginPosition+1);
}
free(pTemp);
}
else
{
printf(”%03d:\t%s\n”, ++num, input);
}
}

int main()
{
char szInput[10];
strcpy(szInput, “abcd”);
int nLength = strlen(szInput);

permutations(szInput, nLength, 0);
return 0;
}

40.                       /* Code to check whether a linked list is circular or not */

pointer1 = a_node;
pointer2 = a_node;
while( pointer2 )
{
pointer2 = pointer2->next;
if( pointer2 == pointer1 )
{
puts( “Circular” );
break;
}
if( !pointer2 )
{
puts( “Not circular” );
break;
}
}

41.                       The Orignal Solution given for Checking whether circular link list is better one as with this solution we can also check for Circular link list which are of
type 6 not 0. By 0 i mean the link list in which the last element points to head. Where as there as link lists of shape 6 in which the last element may point to some other element than start.

42.                       What is the purpose of the isCircular linked list question?

I don’t see how you take that question and arrive at the two pointer and moving at different speed answer. Looks like you find two different people, those who have heard the answer and those who have not. Is there something I am not seeing? Is there some way that if you have never heard of this soultion start out with a small example and build up to the end soultion?

Rizzo

 Rizzo

43.                       About: output = (X & Y) | (X & Z) | (Y & Z)

output is true if:
Z is true and Y is true
or
X is true and (any Y or Z is true)

 Alex

44.                       to find a circular list

//head is the starting of the list//

//i assumed like, if it is a circular list it will come back to head

//otherwise it will be end with NULL

node = head;

while(node!=NULL)
{
if (node==head)
{
printf(”Circular”);
Exit(0);
}
node = node->next;
}
printf(”Non circular!”);

Is this work fine or will create any problem? please mail me.
if possible tell me the exact way and little bit explanation.

Thanks,

 Amarnath

45.                       Amarnath,
you will exit on the first iteration itself, since
node==head to start with

harshit

 Harshit Kumar

46.                       Answer for Comment 28
To ensure that the addresses of two different objects will be different. For the same reason, “new” always returns pointers to distinct objects.

 sach

47.                       Comment to comment 44: (X,Y,Z bit operations)

Alex, that is not what they meant. The operations are bitwise, therefore the problem is not logical. The X, Y, and Z are numbers and the ourput is also a number. The output will have set such bits, that are also set in at least two input numbers. I think. For example: it would ouput (0) for [1,2,4], and (2) for [2,3,6].

 Arnost

48.                       HI,
I need an algorithm to insert a node in a circular linklist without traversing it.

Regards,
Subha

 Subha

49.                       /*
* Hi, I’ve written a code to get all the permutations from a char array,
* and It is Okay.
* I would like to communicate with all of you about c ++ and c,
* My email address is linlin98449@tom.com, eater to hear from you
*/
#include
#include

int linenum = 0;

void swap(char* pstr, int pos1, int pos2)
{
register char tmp = * ( pstr + pos1 );
* ( pstr + pos1 ) = * ( pstr + pos2 );
* ( pstr + pos2 ) = tmp;
}

void permutation(char* pstr, int len, int startpos)
{
int i;

if(startpos

 Wang Yuan Lin

50.                       //Answer for is Circular link list
//start and p initially the given pointer

While(p)
if(start==(p=p->next))
printf(”Circular”);
printf(”not a circular”);

#What say

 Rohit

51.                       I tried to solve the question using the approach given by Hari :)
“Write a prog to accept a given string in any order and flash error if any of the character is different. For example : If abc is the input then abc, bca, cba, cab bac are acceptable but aac or bcd are unacceptable.

 Hari ”
#include
#include

void main()
{
char s[10],dup[10];
int sum_org=0,sum_dup=0;
printf(”\nEnter the string “);
scanf(”%s”,s);
sum_org=parse_sum(s);

printf(”\nEnter the duplicate string :”);
scanf(”%s”,dup);
sum_dup=parse_sum(dup);

if(sum_org==sum_dup)
printf(”\nAllowed duplication”);
else
printf(”\nNot same !!”);
}

int parse_sum(char *s)
{
char temp,*c;
int equi,sum=0;
c=s;
while(*c!=’’)
{
temp=*c;
equi=temp;
sum=sum+equi;
c++;
}
return sum;
}

 neetu

52.                       Code for printing out all permutaions of a string, gurantee to work correctly:

#include
#include
#include

//recursive function to permute a string
void permute(char permulist[], int start, int n)
{
char templist[100];
char tempchar;
int i;
if (start == n-1)
{
for (i=0; i>str;
n = strlen(str);
permute(str,0,n);
return 0;
}

 kevin

53.                       test program for comment 53 (print out permutations)
int main()
{
char str[100];
int n;
cout>str;
n = strlen(str);
permute(str,0,n);
system(”PAUSE”);
return 0;
}

 kevin

54.                       The followint header files should be included in Comment 53 and 54:
iostream.h
stdlib.h
string.h

 kevin

55.                       sorry, this website wipes out the character “

 kevin

56.                       can anyone tell how to find the common node in a circular list without flagging?? in o(n) time

 Thej

57.                       can anyone tell how to find the common node in a circular list without flagging?? in o(n) time

Please elaborate the question. It is not clear. What is a common node in cicular list???

 Sachidanand Joshi

58.                       Hi friends this is the best solution to find Circular Linklist in O(n).

// Best solution
function boolean hasLoop(Node startNode){
Node slowNode = Node fastNode1 = Node fastNode2 = startNode;
while (slowNode && fastNode1 = fastNode2.next() && fastNode2 = fastNode1.next()){
if (slowNode == fastNode1 || slowNode == fastNode2) return true;
slowNode = slowNode.next();
}
return false;
}

 

Posted in Uncategorized | Leave a Comment »

FAQ 32Bit Controller

Posted by alldatasheet on August 25, 2007

ABOUT THE 8051 Microcontroller Family


1.1)  The 8051 microcontroller?

The 8051 is an 8 bit microcontroller originally developed by Intel in

1980.  It is the world’s most popular microcontroller core, made by

many independent manufacturers (truly multi-sourced).  There were 126

million 8051s (and variants) shipped in 1993!!

A typical 8051 contains:

- CPU with boolean processor

- 5 or 6 interrupts: 2 are external

2 priority levels

- 2 or 3 16-bit timer/counters

- programmable full-duplex serial port

(baud rate provided by one of the timers)

- 32 I/O lines (four 8-bit ports)

- RAM

- ROM/EPROM in some models

The 8051 architecture is a tad bizarre, but then so are the

architectures of most microcontrollers due to their specialization

(check out the PIC for creativity).  One vexing problem with the 8051

is its very non-orthogonal instruction set – especially the

restrictions on accessing the different address spaces.  However,

after some time programming the chip, you can get used to it – maybe

even appreciate it.

One strong point of the 8051 is the way it handles interrupts.

Vectoring to fixed 8-byte areas is convenient and efficient.  Most

interrupt routines are very short (or at least they should be), and

generally can fit into the 8-byte area.  Of course if your interrupt

routine is longer, you can still jump to the appropriate routine from

within the 8 byte interrupt region.

The 8051 instruction set is optimized for the one-bit operations so

often desired in real-world, real-time control applications.  The

boolean processor provides direct support for bit manipulation.  This

leads to more efficient programs that need to deal with binary input

and output conditions inherent in digital-control problems.  Bit

addressing can be used for test pin monitoring or program control

flags.

1.2)  8051 Flavors

The 8051 has the widest range of variants of any embedded controller

on the market.  The smallest device is the Atmel 89c1051, a 20 Pin

FLASH variant with 2 timers, UART, 20mA.  The fastest parts are from

Dallas, with performance close to 10 MIPS!  The most powerful chip is

the Siemens 80C517A, with 32 Bit ALU, 2 UARTS, 2K RAM, PLCC84

package, 8 x 16 Bit PWMs, and other features.

Among the major manufacturers are:

AMD      Enhanced 8051 parts

Atmel    FLASH and semi-custom parts

Dallas   Battery backed, program download, and fastest variants

Intel    8051 through 80c51gb / 80c51sl

Matra    80c154, low voltage static variants

OKI      80c154, mask parts

Philips  87c748 thru 89c588 – more variants than anyone else

Siemens  80c501 through 80c517a, and SIECO cores

SSI      80×52, 2 x HDLC variant for MODEM use

Advanced Micro Devices (AMD)

AMD has a number of enhanced variants including such features as:

dual data pointers, slave interface with arbitration unit, dual

port RAM, FIFO buffers, and others.

Atmel

The smallest current device is the ATMEL 89c1051, a 20 Pin FLASH

variant with 2 timers, UART, 20mA.  ATMEL was the first with

standard pinout FLASH, and with more program cycles than other

custom pinout FLASH.  These parts compete with OTP and MASK

product on price, but eliminate inventory problems and the hidden

costs of OTP development.  This will put real pressure on

“vanilla” micros like PIC and ST6.

Dallas Soft Microcontrollers – DS5000(T), DS5001(T), DS2250(T)

The Dallas Soft Microcontrollers have standard 8051 cores with

on-chip non-volatile RAM instead of ROM.  This gives the user the

ability to easily alter the system and is perfect for data

logging.  These processors are available in both chip and module

solutions.  Among the features included in this family of

products:

- on-chip non-volatile RAM

- loader in ROM for downloading programs (eliminates the hassle

of EPROM erase/program/install cycle)

- built in real time clock option

- watchdog timer

- software security (program and data encryption)

The DS500x is a standard 40 pin DIP package (well, mostly

standard, it is really a BOX which is about double the height of a

normal chip).  The DS225x is a SIP version which is functionally

identical to the DS5000 but usually a bit less expensive.

The nice thing about having the RAM on-chip, is that the I/O ports

are unaffected.  When the RAM is configured as CODE memory, the

DS5000 behaves exactly as a single-chip 8051.  The NV-RAM is

static with a built-in lithium battery, and has no limitations on

the number of writes.  You can download your code as many times as

you like without damaging the device.  The DS5000 also includes a

loader in ROM, which permits you to bootstrap code into the RAM to

get underway.  The loader and on-chip RAM have an encryption

feature with which you can protect your code from being read back

from the device if you wish.

Dallas High-Speed Micros – DS80c320, DS87c520, DS87c530

Real barn-burners – performance up to 10 MIPS!  Dallas was the

first to speed up the core.  Wasted clock and memory cycles have

been removed using a redesigned processor core.  As a result,

every 8051 instruction is executed up to 3 times faster than the

original for the same crystal speed.  Clock speeds from DC to

33MHz!

High performance doesn’t just mean speed.  High integration gives

the user 2 full-duplex hardware serial ports, 13 total interrupt

sources (6 external), watchdog timer, power management, power-fail

reset, and other features.

Intel MCS-51

Introduced in 1980, it has become the industry standard for

embedded control.  Intel offers a wide variety of 8051 versions

with different configurations of on-board EPROM/ROM.  Also low

power, high integration, and specialized parts are also offered.

Intel MCS-251

Intel has announced the MCS-251, which is 100% binary and pin

compatible with the 8051, but with a 5-15 times boost in

horsepower.  This is achieved by a six fold gain in bus cycles,

and further hardware improvements to avoid wasted bus cycles.

Delivery early 1995.

Further performance gains are possible by recoding critical

sections to use the extended features of 16 and 32 bit data

transfers, arithmetic and logical instructions, register to

register operations, enhanced BIT manipulations and improved

control instructions.  In addition to extra 16/32 bit

instructions, the 251 includes 40 register with Accumulator and

Index functions overlayed as 16×8, 16×16, 10×32.

Pin compatible parts allow instant performance upgrades, and the

binary compatibility truly preserves users investment in code and

tools.  By staying firmly in the 80×51 camp, Intel allows users

transparent access to an enormous horsepower range.  To further

improve throughput in numerically intensive areas, users can use

INTEGER, LONGINT and FLOAT libraries written for the MCS-251.

Philips

Philips has more 8051 variants than anyone else.  Among the

derivatives that they have:  40MHz, 24 pin skinny DIP, low

voltage, quad flat pack (QFP) versions for saving board space,

OTP, I2C bus, and so on.

The c5xx line features high integration, with many built-in

features including built-in EMI/RFI suppression.

The c7xx series are very low-end, inexpensive micros.  They are

offered with less memory (1k, 2k, etc.) and fewer features.  In

fact the 83c750 sells for only $1 in very high OEM volumes.

Siemens sab80c517a

The 80c517a is one of the most powerful 8051 variants available.

It features high clock speed (40 MHz), and high integration with

32 Bit ALU, 2 UARTS, 2K RAM, PLCC84 package, 8×16 bit PWMs, and

more.

1.3)  8051 representatives and approximate prices (in USD $)

There are many, many varieties of 8051 out there.  This is only a

small sampling of typical prices on Intel chips.

8031 (128 bytes RAM)……………………………..3.59

80C31 (CMOS version of previous)…………………..6.95

8051AH (256 bytes RAM)……………………………6.95

8051AHBASIC (w/Basic interpreter built in)…………29.95

8751 (4K EPROM, 128 bytes RAM)……………………26.95

87C51 (CMOS version of previous)………………….39.95

1.4)  Advantages realized in implementing control applications on this

family of microcontrollers

Popular – readily available and widely supported, a full range of

free and commercial support products is available

Fast and effective – the architecture correlates closely with the

problem being solved (control systems), specialized instructions mean

that fewer bytes of code need to be fetched and fewer conditional

jumps are processed

Low cost – high level of system integration within one component,

only a handful of components needed to create a working system

Wide range -  ONE set of tools covers the greatest horsepower range

of any microcontroller family, other suppliers handle a number of

DIFFERENT and INCOMPATIBLE (and often single-sourced) cores to cover

the same power range as the 80×51, the 8051 provides a real cost

savings in tools, training, and software support

Compatibility – opcodes and binaries are the SAME for all 80×51

variants (unlike most other microcontroller families)

Multi-sourced – over 12 manufacturers, hundreds of varieties,

something for everyone with the security of ready availability

Constant improvements – improvements in silicon/design increase speed

and power annually, 16 Bit models coming from several manufacturers,

low cost skinny DIP models now available

32 bit Microcontroller

 

1. What are the recommended software and hardware development tools for Oki’s ARM MCUs?

One of the great benefits of the ARM platform is its standard open architecture nature which enables 3rd party software development tools vendors to easily support the ARM platforms on their development environment. Also, ARM has pursued a policy of 100% Instruction Set Architecture (ISA) compatibility on any ARM licensed core. As a result, there are numerous 3rd party vendors that offer state of the art software development tools for Oki’s line of ARM based micro controllers. A list of these vendors can be obtained from your local Oki sales representative.

2. What is a JTAG/ICE interface?

Oki’s ARM MCUs have a built-in On-Chip Debug capability facilitated through the EmbeddedICE macrocell built-into each chip. EmbeddedICE is an extension to the core architecture and provides the ability to do in-circuit-emulation with deeply embedded cores.

The EmbeddedICE macrocell, adds a JTAG TAP controller and breakpoint/watchpoint logic to the ARM microcontroller which can be accessed externally through a JTAG port. Hence, software debug is facilitated by interfacing these JTAG pins of the micro to the host development system containing the ARM software development tools through a JTAG interface board such as ARM MultiICE. The following figure illustrates the connection between a host development system and the JTAG port of Oki’s ML674000 CPU-board.

JTAG = Joint Task Action Group
ICE = In Circuit Emulation

3. Do Oki’s ARM MCUs support Little-Endian or Big-Endian format?

Oki’s ARM MCUs support Little-Endian format only. Although the ARM architecture supports both configurations, Oki’s ARM Micros have been configured to only use Little Endian format.

4. What are the different memory types supported by ML674000?

ML674000 supports SDRAM, EDO, SRAM, Flash and standard ROMs. ML674000 can interface to up to 64 MB of SDRAM, 16 MB of flash, SRAM, ROMs, or I/O peripherals.

5. How much SDRAM can be controlled through ML674000’s SDRAM external memory bank?

ML674000’s external memory controller can interface with up to 64 Mbytes of SDRAM through the SDRAM Bank.

6. What is the maximum operating frequency of Oki’s ARM MCUs?

ML674000 operates up to 33 MHz
ML671000 operates up to 24 MHz
ML670100 operates up to 24 MHz

7. What is AMBA?

AMBA is a well-established specification for processor bus architectures. It stands for Advanced Microcontroller Bus Architecture. The AMBA architecture standardizes the on-chip connection of different IPs and thus enables IP reusability.

AMBA specification defines three defferent buses: ASB, AHB and APB. AHB stands for Advanced High-performance Bus. This is the premiere bus used for high performance system modules such as memory controllers and Interrupt controllers. ASB stands for Advanced System Bus. This is an older version which has been superseded by AHB. Oki’s ARM micros always use the AHB bus. APB stands for Advanced Peripheral Bus. It is a simple lower performance and low power bus used for low speed peripherals. Macrocells designed to interface with AMBA can be seen as building blocks which can be reused in future designs and mixed and matched in different combinations to realize complex systems in a shorter period of time.

8. What is Thumb?

Thumb is a 16-bit extension to ARM’s 32 bit instruction set. It enables writing of 16-bit instructions for an ARM micro. The 16-bit instructions are decompressed in to comparable 32-bit ARM instructions during processing.

There are some major advantages to Thumb. Thumb code gets better code density that 32-bit ARM code. Thus there is memory saving and less power consumption with Thumb. It also enables ARM/Thumb MCUs to run efficiently from an external 16-bit data bus thus reducing the price of the LSI by reducing external bus size. When instructions are being fetched from an external 16-bit bus, Thumb code is more efficient and gets better performance results.

9. Can I run Windows CE or Linux on Oki’s ARM7 MCUs?

Operating systems such as Windows CE and Linux require a Memory Management Unit (MMU) to run. ARM7TDMI cores do not have a built in MMU. Therefore Windows CE is not supported on them.

There are versions of Embedded Linux that can run on micros without an MMU. One such popular version of Linux is uCLinux. For more information on this refer to www.lineo.com

In the ARM world, generally ARM cores that have the name ARMX2XTxxx, the 2 designates MMU capability and thus support for operating systems such as Linux and Windows CE. For example ARM920T or ARM720T have MMUs.

10. Is the ML674000 5-volt tolerant?

No. The maximum voltage at any pin of the ML674000 should not exceed 4.9 V.

11. Does GNU Software Development tools support ARM?

ARM7 is currently fully supported by GNU public domain software development tools. There is complete C, C++, Assembler, linker and debugger available which is supported on Windows as well as Linux systems. There is also comprehensive documentation available on GNU’s ARM support.

For more information about GNU tools for ARM please refer to sites such as www.GNU.org or www.redhat.com. Also ARM Developer Zone (www.armdevzone.com) has very good information on this subject.

12. How do I bring up the ML674000 CPU board once I receive it?

ML674000 CPU board is shipped with a complete set of driver software for all of its peripherals. In addition, there are startup and Interrupt routines that can initialize the board. Memory Controller initialization routines and flash programming utilities are also included.

Once the customer receives the board, they can readily load the bundled software into their software development tools and execute them. There is also a Software User’s Manual that can help the user get started.

The bundled software has been developed and written for ARM SDT 2.5 software development tools. This software can be used in ARM ADS as well by simply translating or recreating the project file. To run the software in other 3rd party development tools, minor modifications of source code may be necessary.

13. How much memory is available on the ML674000 CPU board?

ML674000 CPU board has the following memory configuration:
• 8 MB SDRAM
• 1 MB SRAM (2 chips, 512 KB each)
• 2 MB Flash (1 MB occupied by Angel)


14. What is Angel?

Angel is a remote debug monitor program for ARM processors. It is supplied with ARM software development tools (ADS or SDT) in source as well as binaries. Oki’s ARM CPU boards always include Angel, preprogrammed in their onboard flash.

Angel provides the following services:
• Debug capability, including memory inspection, image download and execution, breakpointing and single step
• CPU and board startup and basic exception handling
• A full ANSI C library, using semi-hosting to provide low-level services
• A full source distribution, providing developers with ARM programming examples
Angel interfaces to ARM SDT or ARM ADS debuggers. ARM provides comprehensive documents on Angel protocol as well as Angel porting guides.

15. How come the JTAG connector on Oki ARM CPU-Boards looks so big compared to some other standard JTAG connectors?

There are two types of ARM JTAG connectors commonly used in the industry. One is a 14-pin connectors and the other is the 20-pin connector. The 20-pin connector is used on Oki ARM CPU boards.

16. What is the benefit of having the Mode[0:2] pins on the ML674000 as opposed to handling these tasks through software?

The Mode[0:2] pins of the processor handle the enabling and disabling of the DRAM controller and A-to-D converter of the processor. By disabling these hardware blocks through hardware, the power source to these blocks is cut off and hence power consumption of the ARM processor will drop significantly. Mode[0:2] pins are also tied to additional functionalities such as enabling and disabling the Primary and Secondary functions of Processor pins.

17. What is the MIPs performance of Oki

Oki’s ARM MCUs are based on the ARM7TDMI core. According to ARM Ltd. the figures for calculating the VAX MIPS for ARM are as follows:

The maximum performance of the ARM7 family is 0.9 Dhrystone VAX MIPS per MHz. The maximum performance of the ARM9 family is 1.1 Dhrystone VAX MIPS per MHz.

This figure assumes an ARM core running from 32-bit wide zero-wait state memory.

Oki’s ARM MCUs have a 16-bit external data bus. This features reduces power consumption, reduces the package size and the cost of the package. But since Oki’s micros have a 16-bit wide interface to external memory, when running from external memory, the performance of the processor will be lower than the above mentioned metrics.

For this reason, when running from external memory, the performance of Oki’s ARM MCUs can be significantly improved if using Thumb mode.

To estimate how many ARM instructions are executed per second, divide the frequency of the processor core by the following parameters:

The average CPI for the ARM7 family is about 1.9 cycles per instruction. The average CPI for the ARM9 family is about 1.5 cycles per instruction.

The ARM software development tools, SDT or ADS are bundled with the source code for the Dhrystone program which can be used for benchmarking Oki’s ARM MCUs.

18. How does ARM code compare to Thumb code?

The following is a general comparison of ARM-code vs. Thumb-code solutions:
• Thumb code requires 70% of the space of the ARM code
• Thumb code uses 40% more instructions than the ARM code
• With 32-bit memory, the ARM code is 40% faster than the Thumb code
• With 16-bit memory, the Thumb code is 45% faster than the ARM code
• Thumb code uses 30% less external memory power than ARM code
Therefore Thumb code has a higher density and uses less power. Thumb gives better performance when running off of 16-bit wide memory whereas ARM code gives better performance when running off of 32-bit wide memory.

19. What is Oki ADI Board?

Oki ADI board is a standard JTAG ARM Debugger interface board. ADI stands for ARM Debugger Interface. Oki ADI board is very similar to ARM Multi ICE and its design is intended as a low priced, qualified replacement for ARM Multi ICE in a debugging configuration.

Oki ADI board requires the Oki ICE server to communicate with an RDI compatible debugger on the development host. Oki ICE is a communication server similar to ARM Multi ICE server. Oki ICE is bundled with Oki ADI boards.

Oki ADI board is currently supported only for Windows 98 and Windows 95 systems. Currently there is no support for Windows NT or Windows 2000. Due to this compatibility issue, Oki Semiconductor no longer supports ADI board in the North American Market.

20. When using the ML674000 CPU-board in Normal Mode, I cannot seem to access the Flash memory part 0xc820_0000. The memory that I see at that address seems to be a mirror of the SRAM memory.

To be able to access the flash, you need to first set the PIOA[10:14] to their secondary functions which are XA[19:23]. This is due to the fact that the chip is connected to these high address pins. To do this, you will need to set the Port Function Select Register (GPCTL=0xB7000000). Simply write a ‘1′ to the 2nd bit (GPCTL2) of this register.
0xB700 0000 |= 0×4
Now if you access the Flash addresses, you’ll be able to see the flash chip. For a detailed description of the GPCTL register refer to Ch12 of the ML674000 Users Manual.

Posted in Controllers, Tricks | Leave a Comment »

Difference Among PCM-30C, PCM,PCM31,Unframed,Modulation techniqs

Posted by alldatasheet on August 25, 2007

PCM30C:
In case of PCM30c, The transmission is done in the 32 time slots. the timeslots are divided into 0-15 and 16-31  time slots respectively.
As from the division of time slots, the time slots shows that the 0th and 16th time slots are for special purpose. but rest of the time slots
as 1-15 and 17-31 respectively.

* 30 time slots are reserved for data.
* the 0th and 16th time slots are for that purpose, which is given below:
- 0th bit is for Framming & control, sync byte. and the 16th bit is for Signalling.
PCM30:
In case of PCM30, the transmission is done in the 32 time slots. the time slots are divided into 30(15-15) time slots.
As from the division of time slots, the time slots shows that the 0th and 16th time slots are for special purpose. but the rest of the time slots
(30 time slots) are as 1-15 and 16-31 respectively. but the difference between PCM30C and PCM30 is the 16th time slot is divided into 2 parts as 4-4 bits.
* the 1st 4 time slots are for and rest 4 time slots are for CRC.
* rest of the features are same as PCM30C.

PCM31:
PCm31 is similar to PCM30 but the difference between PCM30 and PCM31 is due to the Signalling. This Signalling is present in the PCM30 and
absent in the PCM31 mode.

NOTE: PCM31 and PCM31C is similar like PCM30 and PCM30C respectively.

Unframed:
Unframed mode is totally different from PCM30/30C and PCM31/31C. In Unframed mode, all the 32 time slots are used for Data Transfer, there is no extra
nurden of Framming & Control and apart from Neither there is Signalling concept nor the CRC concept is present. All the

Posted in Uncategorized | Leave a Comment »

Difference between Emulators & Simulators

Posted by alldatasheet on August 24, 2007

It some time creates Confusion among new user :

What is the emulators: an Emulator is tool which uses harware & software to show the program Executing on some Particular condition,You can be able to see that if some particular event occurs what part of code is executing, the basic aaproach is that u meet with your provided conditions.

What is a Simulator:

A code is written by u is checked for different required output by setting break point etc. it will show u that you are getin the output at some point u intented to. But u can not see what is going on hardware level

Posted in Tricks | Leave a Comment »

Cross Compiler:open source tool for AT91SAM7S Cross Development

Posted by alldatasheet on August 24, 2007

A cross compiler is a compiler capable of creating executable code for a platform other than the one on which the compiler is run. Such a tool is handy when you want to compile code for a platform that you don’t have access to, or because it is inconvenient or impossible to compile on that platform . It is Extremely Required in case of Embedded systems.

 

  • I m Giving here link to download a compiler which is extremly useful

www.yagarto.de

Posted in Compilers, Downloads | Leave a Comment »