From owner-freebsd-questions@FreeBSD.ORG Wed Apr 8 11:37:15 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C6527106566B for ; Wed, 8 Apr 2009 11:37:15 +0000 (UTC) (envelope-from valentin.bud@gmail.com) Received: from mail-bw0-f164.google.com (mail-bw0-f164.google.com [209.85.218.164]) by mx1.freebsd.org (Postfix) with ESMTP id 1297D8FC17 for ; Wed, 8 Apr 2009 11:37:14 +0000 (UTC) (envelope-from valentin.bud@gmail.com) Received: by bwz8 with SMTP id 8so77881bwz.43 for ; Wed, 08 Apr 2009 04:37:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:message-id:subject:to:cc:content-type; bh=qycqeAoWtKOuBCVL/XWKrM9T8u2+8xCpVqyNeKUpgrY=; b=pBcqUbRkCRaf8x8MnKWv+SD9OWuM+tWXrRTm3zt9ZAPLteteyGMqQ+oRAM01ceVj3H hmDlxXVH7OZrdH0eAYoYSweRF0GXjbHp54PU+vXdYxHtKKaUcw+392pIz5lp+jyupJ7o p/W/0V9BS9zWXrWMJaPNmJfhvYMxrNZvcnArw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=mus2x9iKNtSJO6ir5/DbYC5Z1hbmj4uFpxtqEzwga/ry6714gjSUfD0JW/s3ViVbgs sgfh4JlHcGQMtznSSKDVatDM0NWzRukY9NJdD4NSa8s8XwTG6Wvq+aVxSKr/xeIc1MTa xZmYWnZyLXGiATAg6AJClE7wZK5sP24u6wX/o= MIME-Version: 1.0 Received: by 10.103.223.2 with SMTP id a2mr492673mur.88.1239190633975; Wed, 08 Apr 2009 04:37:13 -0700 (PDT) In-Reply-To: <20090408124952.X34961@gwdu60.gwdg.de> References: <139b44430904070241j5227d178jd75f6a93057a150a@mail.gmail.com> <20090408085042.GA54417@melon.esperance-linux.co.uk> <20090408124952.X34961@gwdu60.gwdg.de> From: Valentin Bud Date: Wed, 8 Apr 2009 13:36:58 +0200 Message-ID: <139b44430904080436j7fa08015u1d77c38c51e2583a@mail.gmail.com> To: Konrad Heuer Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Frank Shute , freebsd-questions Subject: Re: C programming question X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Apr 2009 11:37:16 -0000 On Wed, Apr 8, 2009 at 12:52 PM, Konrad Heuer wrote: > > On Wed, 8 Apr 2009, Frank Shute wrote: > > On Tue, Apr 07, 2009 at 11:41:54AM +0200, Valentin Bud wrote: >> >>> >>> Hello community, >>> >>> I have built with a micro controller a system of power plugs that >>> can be controlled through the serial port. I have 2 plugs that i >>> can start/stop and check the status of them. This is accomplished >>> by sending different letters (eg. A/W) to start/stop one of the >>> plugs and another set of letter for the other plug and one letter >>> to check the status. >>> >>> Taking into account the fact that my C skills are almost 0 how >>> complicated would be to write a program so I can control that micro >>> controller through the serial port. Or is there some kind of >>> program that can read/write from/to the serial port from the >>> command line. I don't want an interactive program like minicom, >>> just a program that connects and send a command (a letter in my >>> case) to the serial port. >>> >>> Why not minicom (or any other program like it)? My goal is to be >>> able to start/stop the plugs using a web interface. I have tried >>> using minicom and background it but when i log out minicom closes. >>> If minicom is started i can send commands to ttyd0 with echo, but i >>> can't read anything from serial. >>> >>> Now back to my original question, how hard/complicated will it be >>> to write a C program to control the micro controller through the >>> serial port. >>> >>> Of course on FreeBSD :). >>> >>> >> About 10 years ago I adapted a a C program that was used to control a >> board (which basically had a chip and a thermocouple on it) via the >> serial port. >> >> IIRC, the C was relatively simple but if you're a total beginner then >> it would be hard without cribbing code off the 'net. >> >> If you want to learn C then go for it but if you don't you'd be better >> off using one of the scripting languages: perl, python, ruby etc. and >> your development time will be much reduced. >> >> Also they all have facilities for easily converting your program to >> use the CGI so that you can webify the control and I'm sure they all >> have some module for using a serial port (comms/p5-Device-SerialPort >> in ports for perl). >> > > Please find a program of mine attached; it was used to communicate with a > card reader connected via serial port. Maybe it will help you a little bit > although you don't need all the stuff. > > Best regards > > Konrad Heuer > GWDG, Am Fassberg, 37077 Goettingen, Germany, kheuer2@gwdg.de Thanks everybody for the heads up. I don't know (yet) which path i am going to take. I know a little bit of perl so i guess i'll start reading on how can i accomplish my goal with perl. thanks, v -- network warrior since 2005