Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
T

Tr v

@Tr v
About
Posts
17
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • C CODE FOR RUNNING TWO SENSORS FOR BI-DIRECTIONAL COUNTING
    T Tr v

    Try something like the following for your interrupt handlers. Depending on the micro you select, how to install these will be different. I would stay away from PIC parts, I personally don't like them. The Atmega family of MPU should be better to work with in my opinion, although my personal favorite these days is the Freescale Kinetis family of MPU's. You can get demo boards in the form of expandable towers from Freescale. [EDIT] You may also want to handle rollover for the counter variable if you expect to have counts high enough for this to happen.

    #define S1 (1 << 0)
    #define S2 (1 << 1)

    unsigned char sensorFlags = 0;
    int counter = 0;

    /* interrupt handler for S1 */
    void s1_isr(void)
    {
    if(sensorFlags & S2)
    {
    /* Exiting, decrement counter */
    --counter;
    /* clear S2 flag */
    sensorFlags &= ~S2;
    /* Get timestamp, store it, transmit to remote host
    this will depend a lot on your hardware */
    }
    else if(sensorFlags & S1)
    {
    /* ERROR same sensor tripped twice, handle as necessary */
    }
    else
    {
    /* Entering, set S1 flag */
    sensorFlags |= S1;
    }

    /* clear interrupt flag if necessary */
    }

    /*interrupt handler for S2 */
    void s2_isr(void)
    {
    if(sensorFlags & S1)
    {
    /* Entering, increment counter */
    ++counter;
    /* clear S1 flag */
    sensorFlags &= ~S1;
    /* Get timestamp, store it, transmit to remote host
    this will depend a lot on your hardware */
    }
    else if(sensorFlags & S2)
    {
    /* ERROR same sensor tripped twice, handle as necessary */
    }
    else
    {
    /* Exiting, set S2 flag */
    sensorFlags |= S2;
    }

    /* clear interrupt flag if necessary */
    }

    C / C++ / MFC hardware help

  • C CODE FOR RUNNING TWO SENSORS FOR BI-DIRECTIONAL COUNTING
    T Tr v

    Are the sensors tied to a GPIO line or do you have to talk to them using IIC or SPI? Need a little more info about the sensors before I could offer more assistance. I'm familiar with ARM (mostly Freescale and Atmel stuff) and I'd say that the sensors that I work with are generally tied to a GPIO pin. In that case you just need to read the GPIO pin status or tie it to an interrupt and read them in your app. The logic handling should be simple enough, if S1 is tripped before S2 then increment your counter and log the event to whatever permanent storage you are using, and decrement if you see the sensors in the opposite order. Not having much experience with PIC parts I don't know the exact registers you would need to check for the GPIO status though.

    C / C++ / MFC hardware help

  • PASSWORD
    T Tr v

    If you are referring to windows, you need to dump the SAM file (recommend samdump). Then you can crack the passwords stored in the SAM file. The only way to access the SAM file is while Windows is not running, so you will likely need a live media CD (recommend BackTrack Linux) in order to manage this.

    Mobile

  • Dot matrix printers.
    T Tr v

    We still use and sell dot matrix printers of many different varieties where I work. Nice thing about them for us is they usually have some internal font which doesn't require a driver, making talking to them from an embedded device as easy as sending them plain ascii text. There really is nothing like the annoyingly crunchy sound of them spitting out reams of tractor feed paper, driving your cubicle neighbors crazy with the disruption to their programming mojo by stealing the quiet from the room.

    The Lounge question

  • serial port communication between computer and another hardware device via RS232 in C# for windows Application
    T Tr v

    I don't mind offering assistance on your project if you have specific questions. I understand deadlines and your issue with getting this done in a certain amount of time but for me to 'teach' you about threading and serial port communication is a considerable task. What do you know already? If you are just starting out then I suggest you read the documentation at MSDN on the Threading class and the SerialPort class or check out one of the fine articles here at CP on the subject. That's how I learned how to do a lot of the stuff you are wanting to do. If you have a specific question feel free to contact me (you can click the email link at the bottom of this post) and I will answer the best I can.

    C# help csharp hardware tutorial

  • C# TCP networkstreem problem
    T Tr v

    Luc is leading you in the right direction. In my job we do lots of serial and TCP/IP connection between PC's and various devices. We use both methods he suggests but more often than not the protocols we develop have some start character and stop character to delineate the message. The characters that are meant for this purpose are hex 0x02(send transmission) and hex 0x03(end transmission). These characters work well as neither are printable characters so it is unlikely that you would be sending them in a normal message. If you really want to get picky and guarantee that the data you receive is the same as the data you sent you should be using some form of error checking such as cyclic redundancy check. If you want to do error checking I would recommend using the send/acknowledge system so that your client can let the server know if it got good data and if not it can send a negative acknowledgement to let the server know it needs to resend the data. If you always know how many bytes you are expecting you can always just read that many bytes out of your receive buffer and process them, then go back and read more bytes etc... this might be a simpler solution if you don't want to build some sort of protocol, just be sure that your buffer size is large enough that it won't overflow.

    C# help csharp sysadmin data-structures xml

  • The Warm Glow of the Computer
    T Tr v

    My first computer was a Commodore Vic20 which if anyone remembers was basically a fat keyboard that you could plug cartridges into. I also had the tape drive which was sooooo slow. You could program in BASIC and I spent a lot of time making mine play music. Oh for the days of all that PEEKing and POKEing and GOTO looping =).

    The Lounge question

  • write at a particular position in a text document
    T Tr v

    No, it won't write to a text file. Like it was already said, text files aren't measured in pixels. If you have to save it to a file, the only way would be to save it in some image format. I suppose if you knew your printers resolution (dots per inch, etc..) you could print to a certain x,y location on the page, but as far as a text doc goes, there just aren't any measurements in pixels, so I don't believe it is possible to do exactly what you are wanting to do.

    C# help

  • write at a particular position in a text document
    T Tr v

    You could use the Graphics.DrawString method which will take either a System.Drawing.Point or x and y coordinates in pixels. Just look up DrawString on MSDN for documentation.

    modified on Thursday, August 20, 2009 5:08 PM

    C# help

  • How to use timer control in c#
    T Tr v

    textBox1.Text = "Hello World";

    C# csharp help tutorial

  • project
    T Tr v

    Awww darn, you could save people a lot of trouble. How about a chat server/client. That was one of the first apps I ever wrote and gives good practice communicating via network.

    Java

  • project
    T Tr v

    How about a program that suggests topics for new programs based on some questions asked etc.. If you get one working you should post it here. I'm sure it could be quite useful...

    modified on Thursday, August 6, 2009 1:48 PM

    Java

  • java browser application restrictions
    T Tr v

    Getting your applet signed (such as by Verisign) can increase the things you are allowed to do by giving you a little more access to things outside of the 'sandbox'. Getting your applet signed does cost money...

    Java java question lounge

  • Does anyone know of any command line email programs that work!!!
    T Tr v

    Antone, does it have to be some external command line client, or can you do it within the program itself? If you are able to do it via code, check out the post below "Send email in winform with Yahoo or Gmail account".

    C# question

  • Does anyone know of any command line email programs that work!!!
    T Tr v

    www.beyondlogic.org/solutions/cmdlinemail/cmdlinemail.htm Try this or just google "free command line email client"

    C# question

  • serial port communication between computer and another hardware device via RS232 in C# for windows Application
    T Tr v

    I do a lot of RS232 programming for my job. All of our messages usually start with a special character, such as the hex 0x02 character, followed by a message identifier that we use to let the program know what to do with the message. Then the message is ASCII encoded text followed by a termination character, such as hex 0x03. When a message is received, the starting character, message identifier, and ending character are stripped from the message which is then passed to whatever part of the application it is intended for. If you are having trouble with receiving and sending data, make sure that you are using a crossover cable which has the send and receive wires switched at one end of the cable. If you use a straight through cable then the receiving computer will not be getting the data on the receive pin but the transmit pin, which it won't process. By definition, serial communication means that you cannot get two messages at the same time as you are transmitting the bytes in a 'series'. So as long as you are looking for the stop character to terminate a message then the next message should not get jumbled or lost as long as you don't overrun the buffer.

    C# help csharp hardware tutorial

  • One instance of an application [modified]
    T Tr v

    While he's at it why doesn't he restrict you to using only one hand on a computer without a keyboard or monitor?

    The Weird and The Wonderful database csharp linq business collaboration
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups