SPI - on the fly

Moderator: Benj

Post Reply
User avatar
Mantas
Posts: 221
Joined: Tue May 15, 2012 10:32 pm
Location: Klaipeda, Lithuania - North sea, UK
Has thanked: 57 times
Been thanked: 27 times
Contact:

SPI - on the fly

Post by Mantas »

Hi,

Would it be possible to make some additional macros to be able to change clock polarity and similar settings on the fly? Just in case you have multiple SPI devices with different settings.

Regards,
Mantas
Science is my true religion.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: SPI - on the fly

Post by Benj »

Hi Mantas,

I will see how easy it would be to add something to the CAL file. For now you can control the SPI configuration by using a C icon with the following, replacing the 1's with 0's where needed.

Code: Select all

sspcon.CKP  = 1;		//Assign Clock Polarity
sspstat.CKE  = 1;		//Assign Clock Phase
sspstat.SMP  = 1;		//Assign Input Data Phase

User avatar
Mantas
Posts: 221
Joined: Tue May 15, 2012 10:32 pm
Location: Klaipeda, Lithuania - North sea, UK
Has thanked: 57 times
Been thanked: 27 times
Contact:

Re: SPI - on the fly

Post by Mantas »

But as I can see from the C code it is for PIC mics. For ARMS and AVRS you would need to refer to datasheets for specific C commands. Why not just make a macro where you choose the settings like setings in the component windowby setting ones and zeroes?

Best regards,
Mantas
Science is my true religion.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: SPI - on the fly

Post by Benj »

Hi Mantas,
Why not just make a macro where you choose the settings like settings in the component window by setting ones and zeroes?
That would be the best case situation and I should be able to do this for v6 no problem, however it is unlikely we will apply this mod to v5 unless there is a good reason to? If it will make your life easier then I could be persuaded :D

User avatar
Mantas
Posts: 221
Joined: Tue May 15, 2012 10:32 pm
Location: Klaipeda, Lithuania - North sea, UK
Has thanked: 57 times
Been thanked: 27 times
Contact:

Re: SPI - on the fly

Post by Mantas »

Hi Benj,

Save your energy for v6 as v5 will soon be obsolete :) I am waiting for v6 and I am also hoping that I will be able to port my v5 projects to v6! :) Otherwise it will be "cry me a river..." :D

Best regards,
Mantas
Science is my true religion.

User avatar
JonnyW
Posts: 1230
Joined: Fri Oct 29, 2010 9:13 am
Location: Matrix Multimedia Ltd
Has thanked: 63 times
Been thanked: 290 times
Contact:

Re: SPI - on the fly

Post by JonnyW »

Hi Mantas.

Yes, you will be able to port your projects to v6, though the file format and the structure of the components has changed completely. The format for a v6 project is an XML format, so is human readable and editable - no more corrupted and broken save files!

The components should all convert, though custom components and components with customised code may need to be ported by hand. There is no customise component code feature in v6, and instead you can replace the macros of existing components with your own flowcharts using component inheritance (and produce your own components in this way).

Cheers,

Jonny

Post Reply