Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

anyone is familier from....

Status
Not open for further replies.

rohaan

New Member
hey,
m interfacing my hardware with the help of c language..
so i m having problem with c language code.
does anybody tell me bout it!
the error is..
"declaration is incorrectly"
at the starting braces " { "
please anyone of u who knows how to work in c langauge..help me out!!


Rohaan.
 
Post your code please, makes it easier.
Kind of like me saying "my car doesn't start", and you saying perhaps I'm out of gas, only for me to say, but my car is an electric car...etc
 
the code is..
#include <conio.h>
#include <stdio.h>
#define port 0*378
{ (here the error occur..incorrectly some thing :S)
outportb (0*378,0*7 c)
delay(1000);
outportb(0*378,0 *c 6)
}
 
1. you have to add the line

int main()

before the {

2. replace all * with x i.e. 0x instead of 0*

3. there should not be a space in 0x7c or 0xc6

4. I hope you know this program will work only in DOS (maybe also windows 95/98) Windows 2000/XP prevents direct access to hardware like your parallel port.
 
hey!
Petrv
thanks for explaing
yeah now my c code is running..
but could u pls tell me that if i want to check whether interfacing is working by led to the centronic connector so should i have to connect any external dc supply..if yes so how many volts..
please help me out :S

Rohaan
 
No need for a power supply. just connect a led with a resistor (for example a red LED and 330 ohm resistor in series). Connect the cathode of the LED to one of the ground pins on the parallel port connector and the anode to the resistor. The other end of the resistor connect to the pin of the port you want to test.
If there is '1' on the pin the LED should emit light.
Petr
 
Last edited:
hey petrv,,
can u please tell me the problem which i am facing with interfacing..
actually my project is to glow value on 7segment display, as u have seen the c langauge code.
but the problem is m not reciving the true value (which i am giving in code)on 7 seg display.
as i gave "c7 "=" 83" but it didnt glow 83,rather glowing some thing garbage..
although my seven segments leds are working..
so hwat to do..
further more when i touched the cables through the data is coming to the hardware,it gives effect to the 7 seg display(changes)..
is it loose conection..????

help me out please..

Rohaan.
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top