MANO.5
Member level 1
- Joined
- Mar 15, 2013
- Messages
- 36
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,286
- Activity points
- 1,618
i modified the example random number generation program from keil help section.
keil example program
my program was
when i compile this code it gives 3 warnings and when simulate in proteus it was blinking...no output
this is the 3 warnings from keil
So help me to solve this issue
keil example program
Code:
#include <stdlib.h>
#include <stdio.h> /* for printf */
void tst_rand (void) {
int i;
int r;
for (i = 0; i < 10; i++) {
printf ("I = %d, RAND = %d\n", i, rand ());
}
}
my program was
Code:
#include<reg51.h>
#include <stdlib.h>
sfr lcd_data_pin=0xA0;//p2 port
sbit rs=P1^0;
sbit rw=P1^1;
sbit e=P1^2;
void delay(unsigned int count) //Function to provide delay
{
int i,j;
for(i=0;i<count;i++)
for(j=0;j<1275;j++);
}
void lcd_cmd(unsigned char value)
{
lcd_data_pin = value;
rs=0;
rw=0;
e=1;
delay(1);
e=0;
delay(1);
}
void lcd_data(unsigned char value)
{
lcd_data_pin =value;
rs=1;
rw=0;
e=1;
delay(1);
e=0;
delay(1);
}
void lcd_init()
{
lcd_cmd(0x38);
lcd_cmd(0x0e);
lcd_cmd(0x01);
lcd_cmd(0x80);
}
void lcd_string(unsigned char *disp) //LCD string function
{
char x;
for(x=0;disp[x]!=0;x++)
{
lcd_data(disp[x]);
}
}
void lcd_data_int(int time_val) // to send three digit number
{
int int_amt;
int_amt = time_val/1000;
lcd_data(int_amt+48);
time_val = time_val%1000;
int_amt = time_val/100;
lcd_data(int_amt+48);
time_val = time_val%100;
int_amt = time_val/10;
lcd_data(int_amt+48);
int_amt = time_val%10;
lcd_data(int_amt+48);
}
void tst_rand (void) {
unsigned int i;
i= rand();
lcd_cmd(0x80);
lcd_string("number: ");
delay(250);
lcd_cmd(0xc0);
lcd_data_int(i);
}
void main()
{
lcd_init();
while(1)
{
tst_rand ();
}
}
when i compile this code it gives 3 warnings and when simulate in proteus it was blinking...no output
this is the 3 warnings from keil
Rebuild target 'Target 1'
compiling rand.c...
linking...
*** WARNING L7: MODULE NAME NOT UNIQUE
MODULE: G:\PROGRAM FILES\KEIL\C51\LIB\C51S.LIB (RAND)
*** WARNING L1: UNRESOLVED EXTERNAL SYMBOL
SYMBOL: RAND
MODULE: rand.obj (RAND)
*** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL
SYMBOL: RAND
MODULE: rand.obj (RAND)
ADDRESS: 0129H
Program Size: data=15.0 xdata=0 code=461
creating hex file from "rand"...
"rand" - 0 Error(s), 3 Warning(s).
So help me to solve this issue