Archive

Archive for June, 2007

Cool lightweight statemachine/thread library in pure C

June 25th, 2007

While searching for informtion on statemachines to be used in my “Safe 12vdc to 220vac inverter control box” i sumbled upon an extremely lightweight stackless threads library called ProtoThreads. Although I don’t think I can’t use it because of the stack limitation on the PIC12F508/9 or PIC16F84 that i plan to use, it is worth mentioning.

Here is an abstract of descripton found on the webpage:

Protothreads are extremely lightweight stackless threads designed for severely memory constrained systems, such as small embedded systems or wireless sensor network nodes. Protothreads provide linear code execution for event-driven systems implemented in C. Protothreads can be used with or without an underlying operating system to provide blocking event-handlers. Protothreads provide sequential flow of control without complex state machines or full multi-threading.

A simple task is defined like this:

#include "pt.h"

struct pt pt;
struct timer timer;

PT_THREAD(example(struct pt *pt))
{
  PT_BEGIN(pt);
  while(1) {
    if(initiate_io()) {
      timer_start(&timer);
      PT_WAIT_UNTIL(pt, io_completed() || timer_expired(&timer));
      read_data();
    }
  }
  PT_END(pt);
}

Benjamin Sølberg Electronics, Links

Convert your old PC ATX PSU to a powerful lab supply

June 18th, 2007

Here is a good link on how to do it, including background information..

http://web2.murraystate.edu/andy.batts/ps/POWERSUPPLY.HTM

Benjamin Sølberg Electronics, Links

Beregning af ledningstykkelse

June 14th, 2007

Hvis du skal beregne hvor tyk en leding skal være for at kunne trække en bestemt spænding og strøm, så er der her et link til hvordan man gør samt lidt flere informationer:

http://www.praestkjaer.dk/dk/emner/elektricitet/el-kabel.htm

http://home1.inet.tele.dk/ehh/elektronik/formel/spm/spm.htm

Ohm’s lov

http://home1.inet.tele.dk/ehh/elektronik/formel/ohm/ohmslov.htm

Mit specifikke behov var 12V, 50A = 600W over en afstand på 3 meter.

Så 16mm burde være nok, men jeg gik op på 21mm2 (da det var hvad jeg kunne skaffe) for at være sikker.

Beregning 0,0175 (kobber modstand pr mm2 pr meter) * 6 (2×3m, frem og tilbage) / 21mm2 = 0,005 ohm

50A * 50A * 0,005 ohm = 12,5W tab på ledningerne, altså effekt som bliver afsat i ledningerne alene.

12,5W / 50A = 0,25V spændings tab over ledningerne

Keywords: mm2 ohm modstand Ampere Watt Volt ledningstykkelse kvadrat DC

Benjamin Sølberg Electronics