[Ktechlab-devel] Pic interrupts solved.

santiago gonzalez santigoro at gmail.com
Fri Sep 18 08:51:44 UTC 2009


 Alan:
My coding skills are very very low, but if you have some simple task to me,
i can try....

About the pic simulation:

The create the "clock Mhz" property is solved, now i can select clock speed
and it works well; i have some extrange random behaivors, but the general
idea works.

About the analog input issue, i think i'm aproaching... i can send a fixed
voltage to gpsim and it works, but i have problems to take the node voltage.
I tried this (ktl.0.3.7):

_____________________________________________________________

piccomponentpi.cpp:
-----------------------------------------------------------------------------------------------------------
#include "ecnode.h"
#include "pin.h"

PICComponentPin::PICComponentPin( PICComponent * picComponent, PicPin picPin
)
    : m_id( picPin.pinID )
{
......
......
        case PicPin::type_bidir:
        {
            m_realNode = picComponent->ecNodeWithID(picPin.pinID);
            m_pLogicOut = picComponent->createLogicOut(m_realNode, false );
........
........

void PICComponentPin::logicCallback( bool state )
{
.......
.......
Vth = 3.3
.......
-----------------------------------------------------------------------------------------------------------


piccomponentpi.h:
-----------------------------------------------------------------------------------------------------------
    protected:
......
        ECNode *m_realNode;
-----------------------------------------------------------------------------------------------------------
_____________________________________________________________

This works well, pic takes 3.3 V as analog input and i can use this input
with an adc-read in the pic program.


but if i do this:
Vth = m_realNode->pin()->voltage();

Ktl crashes at startup ( with the last document a circuit with pic)

I also tried this:
_____________________________________________________________

piccomponentpi.cpp:
-----------------------------------------------------------------------------------------------------------
......

void PICComponentPin::logicCallback( bool state )
{
.....
Vth = Vpin
.....

void PICComponentPin::stepNonLogic()
{
    Vpin = m_realNode->pin()->voltage();
}
-----------------------------------------------------------------------------------------------------------

piccomponentpi.h:
-----------------------------------------------------------------------------------------------------------

public:
......
        virtual void stepNonLogic();
        virtual bool doesStepNonLogic() const { return true; }
......
.....
    protected:
......
        double Vpin;
        ECNode *m_realNode;
......

-----------------------------------------------------------------------------------------------------------
_____________________________________________________________

This doesnt work at all, looks like Vpin is never updated.

I see that all logic will be changed and it will work in a diferent way, I
just try to understand.
And i think it should work in ktl 0.3.7 and adapted to the new logic.

Do you think i should wait for the new logic is working?


2009/9/16 santiago gonzalez <santigoro at gmail.com>

> Ok... i think now pic simulation work quite better, the simulation run in
> two diferent ways:
>
> -When runed from the circuit button (play), simulation goes at real time
> for a 20 MHz compiled pic code, registers are not updated, breakpoints
> doesn't have effect, it's just like powering the pic.
>
> -When running from the code (execute), it run slower and updates registers
> view every 25 ms and every cycle when step-by-step, breakpoints and any
> other debug feature works here.
>
> Now i need two things:
>
> -Create the "clock Mhz" property or any other way that the user can choose
> the clock speed. Someone can give a hand wit this?
>
> -Someway to know the voltage level in a pic pin, actually all are defined
> as logicin or logicout, i tried to understand how to do this but i can't
> find the correct way, i had a look to adc component, but have lot of errors
> bcos i really don't understand what i'm doing... all what i need is a float
> value of the voltage level at the input pins.... someone can point me to a
> way to follow?
>
>
> 2009/9/15 santiago gonzalez <santigoro at gmail.com>
>
> Hi Jose..
>>
>> I would like to find the way to have real-time simulations when in
>> run-mode (only for circuit simulation) and a step-by-step or
>> run-step-by-step when in debbuging mode.
>>
>> It looks that actually ktechlab always run in debug mode, then ktechlab
>> calls gpsim every step, but i think is possible to run gpsim in real-time
>> and just wait for gpsim to update port's register changes and call gpsim
>> just when some pin value is changed (not sure). This should be only when the
>> "play" button in the circuit is pressed; when debbuging code and watching
>> registers and so it could run in debugging mode as actually... but this is
>> just a though... still have to understad better how works the gpsim
>> interface.
>>
>> There is also the cuestion of analog inputs, but actually i don't know how
>> to deal with this.
>>
>> Anyway if you want to try the ktl-0.3.7 with interrupts working you can
>> try a .deb package in the "pic linux" forum; just look for the thread:
>> "ktechlab y simulacion de una interrupcion en 16f84".
>>
>> Regards.
>>
>>
>> 2009/9/15 Jose Luis Galvez Lopez <digigalos at yahoo.es>
>>
>>>  Congratulations. When will the new version?
>>> P No imprimir si no es necesario. Protejamos el Medio Ambiente.
>>> Do not print if it is not necessary. Protect Enviroment.
>>> digigalos <http://digigalos.es>
>>> Software libre <http://es.wikipedia.org/wiki/Software_libre>, conocimiento
>>> libre <http://es.wikipedia.org/wiki/Conocimiento_libre>, cultura libre<http://es.wikipedia.org/wiki/Cultura_libre>
>>> .
>>> Usuario Linux <http://counter.li.org/> nº 299.452
>>> Declaración de independencia del ciberespacio<http://es.wikisource.org/wiki/Declaraci%C3%B3n_de_independencia_del_ciberespacio>
>>>
>>>
>>> ------------------------------
>>> *De:* santiago gonzalez <santigoro at gmail.com>
>>> *Para:* ktechlab-devel <ktechlab-devel at lists.sourceforge.net>
>>> *Enviado:* martes, 15 de septiembre, 2009 8:57:12
>>> *Asunto:* [Ktechlab-devel] Pic interrupts solved.
>>>
>>> I think today is my lucky day... i should buy lottery.. :)
>>>
>>> Found the problem with interrupts that didn't work in ktechlab but work
>>> in gpsim.
>>> I think now the pic simulation is faster and my PC's processor doesn't
>>> speed up.
>>>
>>> With a pic program coded at 4MHz, ktechlab  simulates it at near
>>> real-time... perhaps 2/3
>>> I think the aim should be real-time when in run-mode.
>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Come build with us! The BlackBerry® Developer Conference in SF, CA
>>> is the only developer event you need to attend this year. Jumpstart your
>>> developing skills, take BlackBerry mobile applications to market and stay
>>> ahead of the curve. Join us from November 9-12, 2009. Register
>>> now!
>>> http://p.sf.net/sfu/devconf
>>> _______________________________________________
>>> Ktechlab-devel mailing list
>>> Ktechlab-devel at lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/ktechlab-devel
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/ktechlab-devel/attachments/20090918/48587c3e/attachment.html>


More information about the Ktechlab-devel mailing list