Search found 31 matches

by matherp
Thu Feb 28, 2013 4:47 pm
Forum: Compiler
Topic: 64 bit arithmetic
Replies: 8
Views: 5242

Jerry Many thanks - it works perfectly. I can even round the result based on the remainder. The calculation is that required to set the frequency for an Analog Devices AD9850 digital synthesizer. I'd built a version on picaxe but limited to 32 bit resolution which gives about 1:10000 resolution but ...
by matherp
Wed Feb 27, 2013 10:54 pm
Forum: Compiler
Topic: 64 bit arithmetic
Replies: 8
Views: 5242

I need to calculate N=(B * 2^32)/125000000 where B is any integer between 1 and 40,000,000. In this case a lookup won't work.
by matherp
Wed Feb 27, 2013 5:39 pm
Forum: Compiler
Topic: 64 bit arithmetic
Replies: 8
Views: 5242

Unless I'm missing something swordfish doesn't have a 64bit datatype - that is precisely the issue
by matherp
Wed Feb 27, 2013 10:22 am
Forum: Compiler
Topic: 64 bit arithmetic
Replies: 8
Views: 5242

64 bit arithmetic

Hi all I need to multiply two unsigned 32 bit integers to get a 64 bit result and then divide the answer by a 32 bit unsigned integer to give a 32 bit result. The nature of the numbers are such that the answer will always be in the 32 bit range. I'd appreciate any help on how to get started or point...
by matherp
Sat Apr 21, 2012 2:19 pm
Forum: User Modules
Topic: Slave I2C framework on 18F14K22
Replies: 0
Views: 5865

Slave I2C framework on 18F14K22

Thanks to the basis provided by octal I've produced a two way version of the slave i2c code working on a 14K22. The basis of the framework is that the master sends a command byte with bit 7 (go bit) set, followed by any number of data bytes. The interrupt routine on the slave reads and stores the da...
by matherp
Mon Apr 16, 2012 9:39 am
Forum: Modules
Topic: Hardware I2C in slave mode
Replies: 3
Views: 3196

Octal

Thanks for the link

I did use search - honest:-) but didn't check that thread as I assumed the title related to a software i2c implemetation (SI2C) duh....

Did you ever do the upgrade for the newer devices? I'm using 14K22 in this project

Thanks
Peter
by matherp
Tue Apr 03, 2012 8:55 am
Forum: Modules
Topic: Hardware I2C in slave mode
Replies: 3
Views: 3196

Hardware I2C in slave mode

I've searched but can't find any reference to this.

Has anyone built code to use a a pic in i2c slave mode that they can share?

Thanks

Peter
by matherp
Sat Dec 03, 2011 9:51 am
Forum: Compiler
Topic: Issue with booleans?
Replies: 9
Views: 4297

Jerry I've now got to the bottom of the issue but don't understand the problem. I had got that code in the version of system.bas in my user library. I'm fairly certain that I had previously found that you don't need to explicitly "include system.bas" which is why it wasn't in my code. However, by ex...
by matherp
Fri Dec 02, 2011 3:54 pm
Forum: Compiler
Topic: Issue with booleans?
Replies: 9
Views: 4297

Jerry I'm using a version of DS30 which I have modified to use a software uart on the picaxe 28x2 pins (quite pleased with myself on this!). The problem was the software executing the "not enabled" code when the inputs were set as "enabled" and correctly read as such. Senacharim - thanks for the ide...
by matherp
Thu Dec 01, 2011 1:19 pm
Forum: Compiler
Topic: Issue with booleans?
Replies: 9
Views: 4297

As requested. The variables that were booleans are StepDirection,stepactive,Decayout and the changes in the code are just replacement of "x=true" and "if x" wherever they appear. Best regards Peter // if device and clock are omitted, then the compiler defaults to // 18F452 @ 20MHz - they are just us...
by matherp
Thu Dec 01, 2011 12:27 pm
Forum: Compiler
Topic: Issue with booleans?
Replies: 9
Views: 4297

Issue with booleans?

Hi all I'm using 2.2.1.3 registered and have had an issue using booleans. I had defined three booleans Dim a,b,c as boolean was using them through the code e.g. a=true if a then ... endif The definition was the last of my variable definitions. I was getting results which indicated that one of the bo...
by matherp
Tue Jun 21, 2011 4:50 pm
Forum: User Modules
Topic: MCP342x ADC module
Replies: 8
Views: 6147

Ryan I've got both 25K22 and 26K22 working well with SF after Jerry's help. See http://www.sfcompiler.co.uk/forum/viewtopic.php?t=1481 for essential changes to setalldigital needed for these chips which must be called before using i2c etc.. The issue is that there are key registers not in the access...
by matherp
Mon Jun 20, 2011 9:34 am
Forum: Modules
Topic: Solution for bug in trig routines with large angles
Replies: 0
Views: 3222

Solution for bug in trig routines with large angles

There is a bug in the cos routine (and therefore also sine) when the angle in radians is too large. This is demonstrated in the attached test program { **************************************************************** * Name : I2C EEPROM * * Author : David John Barker * * Notice : Copyright (c) 2006 ...
by matherp
Sun Jun 19, 2011 10:00 pm
Forum: User Modules
Topic: MCP342x ADC module
Replies: 8
Views: 6147

I'm building avionics for a homebuilt aircraft . Current project is an EGT system to get best possible leaning
by matherp
Sun Jun 19, 2011 12:00 pm
Forum: Modules
Topic: I2C bus locked up - my solution
Replies: 0
Views: 3447

I2C bus locked up - my solution

When repeatedly programming a chip it is occasionally the case that an i2c peripheral is in the middle of a write when the re-programming takes place. If the peripheral chip is holding SDA low then the i2c start condition will not work to reset the peripheral and the program will probably not run pr...