[AJUDA] Porta Paralela + Leds

Dark_Wolf

Power Member
Pessoal Tou aqui com um problrema.... Srá que me podem dar uma ajudninha...

Nao estou a perceber porque é que este codigo nao compila:

Código:
[COLOR=#339900]#include <stdio.h>[/COLOR]
[COLOR=#339900]#include <conio.h>[/COLOR]
[COLOR=#339900]#include <dos.h>[/COLOR]
[COLOR=#339900]#define LPT1 0x378[/COLOR]
[COLOR=#0000ff]int[/COLOR] main[COLOR=#000000]([/COLOR][COLOR=#0000ff]void[/COLOR][COLOR=#000000])[/COLOR]
[COLOR=#000000]{[/COLOR]
    [COLOR=#0000ff]unsigned[/COLOR] [COLOR=#0000ff]char[/COLOR] Valor=[COLOR=#0000dd]128[/COLOR]; [COLOR=#ff0000]//Em binário: 10000000[/COLOR]
    [COLOR=#0000ff]while[/COLOR][COLOR=#000000]([/COLOR] Valor > [COLOR=#0000dd]0[/COLOR] [COLOR=#000000])[/COLOR]
   [COLOR=#000000]{[/COLOR]   
              outportb[COLOR=#000000]([/COLOR]LPT1, Valor[COLOR=#000000])[/COLOR]; [COLOR=#ff0000]// Envia para a Porta LPT1[/COLOR]
              [COLOR=#0000dd]printf[/COLOR][COLOR=#000000]([/COLOR][COLOR=#666666]"[COLOR=#666666][B]\n[/B][/COLOR]Pressione uma tecla para ascender o próximo LED..."[/COLOR][COLOR=#000000])[/COLOR];
              getch[COLOR=#000000]([/COLOR] [COLOR=#000000])[/COLOR];
              Valor = Valor >> [COLOR=#0000dd]1[/COLOR]; [COLOR=#ff0000]//A cada passagem, o bit 1 é movido para a direita[/COLOR]

O Que é que esta aqui mal???

Isto ta me a dar um erro assim:

C:\Documents and Settings\xxxx\Ambiente de trabalho\Sem Título1.cpp In function `int main()':
13 C:\Documents and Settings\xxxxx\Ambiente de trabalho\Sem Título1.cpp `outportb' undeclared (first use this function)
(Each undeclared identifier is reported only once for each function itappears in.)

Alguem pode dar uma maozinha???
 
Não sei que compilador estás a usar, mas creio que o "outportb" já não está disponível nos mais recentes (.Net, Visual Studio, ...).
Eu ainda usei isso com o Turbo C, mas já foi há muito tempo.
O problema maior é que com os Windozes, o acesso ao hardware ficou muito limitado. O mais provável é teres de usar/criar um device driver.
 
Back
Topo