SPI - on the fly

Moderator: Benj

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

SPI - on the fly

Postby Mantas » Fri Jun 28, 2013 7:35 am

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: 14217
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4356 times
Been thanked: 4095 times
Contact:

Re: SPI - on the fly

Postby Benj » Fri Jun 28, 2013 9:15 am

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: 68 times
Been thanked: 27 times
Contact:

Re: SPI - on the fly

Postby Mantas » Fri Jun 28, 2013 3:20 pm

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: 14217
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4356 times
Been thanked: 4095 times
Contact:

Re: SPI - on the fly

Postby Benj » Fri Jun 28, 2013 5:28 pm

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: 68 times
Been thanked: 27 times
Contact:

Re: SPI - on the fly

Postby Mantas » Sun Jun 30, 2013 8:26 am

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: 64 times
Been thanked: 306 times
Contact:

Re: SPI - on the fly

Postby JonnyW » Tue Jul 02, 2013 9:22 pm

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
These users thanked the author JonnyW for the post:
Mantas (Thu Jul 04, 2013 9:28 pm)
Rating: 5.26%