Help answer threads with 0 replies.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 05-04-2013, 03:01 PM   #1
LQ Newbie
Registered: Mar 2009
Location: denmark ballerup
Distribution: 13.04
Posts: 4

Rep: Reputation: 0
something about my strobe programming

TheNbomr gave me an answer about programming my strobe thank, but i am newbeginner. On my parrallelport leg 1 2 3 4 5 6 7 8 9 i have strobe as number 1 and i want to program strobe on or out but stil have my other legs working as 1 2 4 8 16 32 64 128. I would like to use my spacetast as pressed strobe on and unpressed as strobe off. I can se something is done with strobe when i try to add 2 on 278+2 Then i se strobe is working but not on the right manner. #include <stdio.h>//In use
#include <stdlib.h>// In use
#include <sys/io.h>//In use
#define base 0x378 /*Here is Port defined*/

main(int argc, char **argv)
int x;
int value;
x = 0;
if (ioperm(base, 4, 1))
perror("ioperm"); exit(1);// Use sudo !
printf("\nInput fra 0 til 255 ");
value = (x);
printf("\nPortout= %d", value); /* Show Output on Led's */
outb(value, base);

#define base 0x378+2 will programme strobe on and out vhen i give input

1 2 3 4 up to 255 but my dato on D0 D3 D2 D3 D4 D5 D6 D7 D8 are not working more. Therefor my new question about strobe I think i shall invoke a case statement ? Here my first case beginning program

#include <stdio.h>//In use

int main() {

int x = 1;

printf("Vaelg 1: Strobe on,2: Strobe off:\n");

scanf("%d", &x);
switch (x) {
case 1:
//Here i think i shall work with ports
printf(" Strobe on\n");// led 1 on
case 2:
//Here i also shall work with ports
printf("Strobe off\n");//;Led 1 off

return 0;


in case 1 and case 2 i shall give som portcommmands ? But how ???

Hope somebody understand my questions Thanks all here Ole
Old 05-06-2013, 10:44 AM   #2
LQ 5k Club
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,397
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
Pull out your C language textbook, and learn about the operators '|' (bit-wise OR) and '&' (bit-wise AND), and while you're in the neighborhood, learn about '^' (exclusive-OR) as well. Understanding those operators is the key to knowing how to set & clear specific bits in a word. Since you're already using outb() to write to the port, consider using inb() to read from the register. Modify the value that you read from the port using bit-wise logic operators, then write the result back out.

  • Don't shout
  • Post source code in [CODE] [/CODE] tags to preserve formatting

--- rod.

Last edited by theNbomr; 05-06-2013 at 10:47 AM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
how do i program strobe on and off oz6oh Programming 1 05-01-2013 09:11 AM
jack "strobe" tuning program ninja master Programming 0 09-30-2011 11:24 PM
Why the STROBE pin in parallel port?? arunshivanandan Linux - General 3 09-01-2004 08:28 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:48 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration