cdb | 1 Sep 01:01
Picon

Re: [PIC] CCP range and limiting


:: ;   Software timer
:: ; SWTmrHigh  ; bits 23-16
:: ; SWTmrMid   ; bits 15-8
:: ; SWTmrLow   ; bits 7-0

This looks similar to Roman Black's/Bob Ammerman's Bresenham Algorithm, which I borrowed (copied?) in my
water flow meter project

void Interrupt()
{

 if(PIR1&(1<<TMR2IF))
  {
    #asmline bcf PIR1,TMR2IF            ;Timer 2 Flag
    SysFlag.Tmr2=1;
  }

 if(INTCON&(1<<T0IF)) 		        // Test TMR0 interrupt flag
  {
    #asmline bcf INTCON,T0IF           ;  Clear TMR0 interrupt flag
    SysFlag.Tmr0=1;    		

    if(TickMid!=0)			//Has TickMid reached zero
      {
    	if(--TickMid!=0)	
        return;               	        //if not decrease and check for zero
      }
    else				//Tickmid was zero so decrease TickHigh
      {
(Continue reading)

Sean Breheny | 1 Sep 01:49
Picon
Favicon

Re: [EE]: Motor speed control via back-EMF detection

Hi Phil,

Looking at the datasheet, here's what I think is going on:

The two transistors shown in the block diagram form a current mirror.
That is, they are sized in such a way that, under most conditions, the
current in one will be 1/20th of the current in the other. The
higher-current one is then used to control the motor. The current
through the smaller one (in other words, through pin 4) is 1/20th of
the motor current. This current is passed through a resistor which is
roughly 20 times the motor resistance, so that the voltage across it
will be equal to the voltage drop across the motor resistance. This
value is then added to a reference voltage and compared to the motor
voltage.

Let Vref be the reference voltage and Vr be the voltage across the
resistor Rt in the application schematic. If the motor voltage drop is
more than Vref+Vr, current to the motor is turned off until the motor
voltage drops. Conversely, if the motor voltage drop is less than
Vref+Vr, the motor is turned on. Very close to the setpoint, the
comparator probably operates like a linear amplifier so that you don't
normally see it switching on and off. The pot is then just a way to
adjust the gain by allowing some current from the sense resistor to
leak into the motor circuit.

Another way of saying this in a much simpler way is that this circuit
compensates for the motor winding resistance. Saying it "senses back
EMF" is an overly-glorified statement. It just measures the current
through the motor, multiples by some resistance, and then adds this in
to the reference voltage it is applying to the motor. This makes the
(Continue reading)

Jason Hsu | 1 Sep 02:16
Picon

[PIC]Using C instead of Assembly language

Thanks for the suggestions on how to program microcontrollers in C
instead of Assembly language.

In the process of trying to get started, I can see why Assembly
language is MUCH more popular among hobbyists than C.  There is
EXCELLENT support for Assembly language.  MPLAB offers FREE and full
functionality for Assembly language programming of microcontrollers.

Most of the available tools for C for microcontrollers are very costly
(hundreds or thousands of dollars).  The free tool PICC-LITE works for
very few microcontrollers.  The open source tools are tricky to set up
and are in alpha state.  I have been able to work with PICC-LITE.
Until I can get GPUTILS to work on my Linux machine (gtkextra
installation problems), I won't be able to use SDCC on it either.

I've summarized my experience at http://www.jasonhsu.com/microcontroller.html .

I'm going to try GPUTILS/SDCC in Windows next.  But before I do, what
are the prerequisites for these programs (in addition to gcc)?

Would I have an easier time with Ktechlab?  Or PiKdev/lab?  Does
dependency hell come into play here as well?  I haven't tried these
yet.

What are my other options?

Given that I would like to turn my experience in microcontrollers into
a career and that C is much more widely used in industry than Assembly
language, I need more experience using C for microcontrollers.  Having
as much experience with C as I already have with Assembly language
(Continue reading)

Phil Keller | 1 Sep 02:22

[PIC] Using Register Trace

I am trying, unsuccessfully, to use the Register Trace within the 
simulator.  The design is a simple RS-232 interface with an internal 
state machine based on the value received on the RS-232 interface.  I 
would like to have use the UART1 as part of the simulator but since it 
only supports ASCII and when data is written to a file the MSB is 
truncated I must use the trace capability.

My input stimulus is from a text file and read in via the UART I/O.  
That portion works fine.

I have, I think, configured the Stimulus to store the TXREG value on 
Demand into a file TX_REG.txt.
I have no other stimulus.
Clicking "Advanced" and "Generate SCL file" completes without complaint.
Clicking "Apply" I get the error message that "Failed to send 
synchronous stimulus to simulator".
Running the simulator, the UART I/O window updates as I expect based on 
the data sent via the UART input file, but the Trace file is not created.

I have looked on the uChip WEB site and in the PICLIST archive without 
success.

Suggestions of where to look or solutions are appreciated.

Phil

--

-- 
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
(Continue reading)

cdb | 1 Sep 02:39
Picon

Re: [PIC]Using C instead of Assembly language


:: I'm going to try GPUTILS/SDCC in Windows next

Instead of downloading new tools, you could try downloading and installing andLinux on your Windows
system - it runs a basic version of Linux as a service in Windows.

I am using it for the Linux version of XCSB - which works well. So if you have a Linux tool you've got used to,
then this might work also for you.

www.andlinux.org

Colin
--
cdb, colin <at> btech-online.co.uk on 1/09/2008

Web presence: www.btech-online.co.uk  

Hosted by:  www.1and1.co.uk/?k_id=7988359

--

-- 
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

Xiaofan Chen | 1 Sep 02:58
Picon

Re: [PIC]Using C instead of Assembly language

On Mon, Sep 1, 2008 at 8:16 AM, Jason Hsu <jhsu802701 <at> gmail.com> wrote:
> Until I can get GPUTILS to work on my Linux machine (gtkextra
> installation problems), I won't be able to use SDCC on it either.

Who told you sdcc needs gtkextra? Only gpsim needs gtkextra.

What is the Linux distribution you are using? Most of the new
main-stream distributions will have gputils/sdcc/gpsim/piklab
available. Sometimes they are a bit outdated compared to
the latest svn version but they should get you started. If you
want to build from source,  gputils/sdcc do not require too
much dependency to be built. After all, both are console version
without GUI. For gtkextra, you can download the source and build
from the source. Then you can build gpsim. piklab requires
KDE development packages.

Xiaofan
--

-- 
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

Re: [OT] water as fuel for car :


Like I said... Beer ( I forgot scotch)... headache

At 12:09 PM 8/31/2008, you wrote:
>I tried to get to that link, but it is "offline". Instead, I found this
>jewel through a link on it:
>
><http://thewayhomeorfacethefire.info/introduction/>
>
>Man, you can find in this "book" (at least that's what the introduction
>says) that the real meaning of our lives on earth is depicted and explained
>in STARWARS movies, episodes 4,5 and 6 (not 1,2 or 3; those are
>"wrong")!!!!!
>
>Now, let me get back to work, this got me a headache ;)
>
>*Carlos Marcano*
>-Guri, Venezuela-
>
>2008/8/31 Grif w. keith griffith <kgriffit <at> wolfenet.com>
>
> >
> > Oh Man!!!  Ok,,, you trumped me on that one.  The first site I went to.
> >
> > Warning, this link is really OT.  Religious, Political,
> > Economic,  Bad Science and a bit of hysteria all on one well done page.
> > http://merlib.org/node/5190
> >
> > you just can't begin to make this stuff up
> >
(Continue reading)

PicDude | 1 Sep 07:58

Re: [EE] Eagle to dxf or g-code (for milling PCB outline/shape)?


William &quot;Chops&quot; Westfield wrote:
> 
> 
> On Aug 30, 2008, at 9:50 AM, PicDude wrote:
> 
>> ut what I need is a relatively simple way to output the
>> lines on the milling layer to dxf or g-code so I can de-panelize  
>> the boards.
> 
> Aren't there multiple hpgl to gcode converters?  You should be able  
> to output milling layers to hpgl files easily using the CAM  
> processor, and I'd think those would be easier to deal with than  
> gerber files.   Generating milling layers from dimension layers may  
> be slightly harder, since the "outlines generation" in eagle only  
> works on signals, but it should be well within the capabilities of a  
> ULP...
> 
> My LPKF "Circuitcam" does this quite easily;  you give it a layer or  
> a selection, and tell it to mill inside or outside with a particular  
> tool.  I dunno whether you can find a cheap copy though.
> 
> BillW
> 
> -- 
> http://www.piclist.com PIC/SX FAQ & list archive
> View/change your membership options at
> http://mailman.mit.edu/mailman/listinfo/piclist
> 
> 
(Continue reading)

David Meiklejohn | 1 Sep 09:08
Picon

Re: [PIC]Using C instead of Assembly language

Jason Hsu wrote:

> Most of the available tools for C for microcontrollers are very costly
> (hundreds or thousands of dollars).  The free tool PICC-LITE works for
> very few microcontrollers.

HI-TECH C PRO, for all 10/12/16F PICs (12- and 14-bit) is now available,
for free, in "lite" mode.  This has no restrictions, but like Microchip's
C18 student mode for the 18Fs, optimisation is turned off.  I've found in
practice that it generates code about twice as large as PICC-Lite - but on
the other hand, there are no memory restrictions, so code can often afford
to be larger.  And you get to use all data memory, without worrying about
bank directives.

Glowing endorsement?  No, because it does generate bloated code.  But hey,
it's free (as in beer - no license restrictions), supports every 16F PIC,
and integrates well with MPLAB (or use HI-TIDE), supports ICD, etc.

David Meiklejohn
www.gooligum.com.au

--

-- 
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

Re: [PIC]Using C instead of Assembly language

A while ago I played with several of the C compilers, including the free 
ones.

The free ones were disappointing - but you might find they work well.

I have C18 from Microchip.  This works well, but only works on the C18 
processors.   I have the full edition, but understand the student 
edition is basically the same, but simply with a few optimizations 
turned off after an initial period.

I also have the full CCS PIC-C PCWH package.   This works quite well.  
If you only want to use it from MPLAB, then you don't need the full 
version... you can buy the appropriate command line compiler for 
somewhat less...  like $150.   You can also get a linux version of 
this.   This is actually my preferred compiler for the PIC16 parts, and 
I sometimes use it for the PIC18's as well.

If you're into cheap, hobbyist C, you might want to try the MikroC.   I 
use it when I'm just hacking out some proof of concept thing, since the 
libs they include are much easier to use.  However, for larger projects, 
it doesn't seem to do as good of a job as the CCS... for instance, it 
doesn't handle large quantities of string constants well - plus 
occasionally I've had it do weird things.     The free version of MikroC 
is limited to 2k of code size - but will compile for any pic 
processor.   To purchase this, you can either pay the full $249, or 
bundle it with a development board for an effective price of $175.   I 
really like the EasyPIC development system - I have an EasyPIC4, and am 
thinking about buying a easypic5 sometime in the future.

I think if I was just going to be doing hobbyist things, I'd consider 
(Continue reading)


Gmane