Search found 628 matches

by mnf
Sat Jul 04, 2020 11:07 pm
Forum: Flowcode V8
Topic: Arduino mega2560 problem with DS3132 RTC
Replies: 12
Views: 215

Re: Arduino mega2560 problem with DS3132 RTC

Just tested on an Arduino Mega - so LED set to 13(B7), SQW connected to D2 (Int4) SDA, SCL VCC and GND connected. - the RTC does as expected - outputs a square wave (checked with oscilloscope) The Arduino doesn't wake from sleep on interrupt however. So remove the C code (sleep) in the loop - and ev...
by mnf
Sat Jul 04, 2020 3:50 pm
Forum: Flowcode V8
Topic: Arduino mega2560 problem with DS3132 RTC
Replies: 12
Views: 215

Re: Arduino mega2560 problem with DS3132 RTC

And did that work?

Other things to check - pull ups on the sda and scl lines ( most rtc breakouts have them installed).
Can you read the time from rtc?

Martin
by mnf
Fri Jul 03, 2020 7:48 am
Forum: Flowcode V8
Topic: Arduino mega2560 problem with DS3132 RTC
Replies: 12
Views: 215

Re: Arduino mega2560 problem with DS3132 RTC

Just noticed:

Your code should give a 0.5s blinker. The clock outputs 500ms high then 500ms low pulse - the 1s is measured rising edge to rising edge (or falling to falling). Outputting the pin level should their give 0.5a on 0.5s off..
by mnf
Thu Jul 02, 2020 7:20 pm
Forum: User Components
Topic: DS3231 revisited
Replies: 4
Views: 99

Re: DS3231 revisited

So for anyone to test: As a (pre)component (there is no simulation) - DS3231.fcpx ds3231 component.fcfx It's pretty much complete - apart from 12h mode (anyone any good suggestions on a suitable syntax - I lean towards Set12h mode and then taking the cue from the RTC value of this flag (and have a p...
by mnf
Thu Jul 02, 2020 7:13 pm
Forum: Flowcode V8
Topic: Arduino mega2560 problem with DS3132 RTC
Replies: 12
Views: 215

Re: Arduino mega2560 problem with DS3132 RTC

Can you get my example to work? If no - RTC may be 'stuck'.

I'm just about to upload my 'component' version - I've added a RestartRTC macro (which might do the trick - clears EOSC and OSF flags)
If not then run the Arduino DS3231 set example or pull the power (inc battery)

Martin
by mnf
Thu Jul 02, 2020 8:08 am
Forum: Flowcode V8
Topic: Arduino mega2560 problem with DS3132 RTC
Replies: 12
Views: 215

Re: Arduino mega2560 problem with DS3132 RTC

A very simple blinkie - using the 1Hz SQW. Note i've used an Arduino Nano - so you'll need to change the LED pin (I've used a property for this) I'm just blinking the built-in LED on B5 blinkie.fcfx Note that this will work without sleeping the MCU (it will repeatedly output 0 or 1 to the pin) - 1kh...
by mnf
Tue Jun 30, 2020 11:05 pm
Forum: Flowcode V8
Topic: Arduino mega2560 problem with DS3132 RTC
Replies: 12
Views: 215

Re: Arduino mega2560 problem with DS3132 RTC

I've tested my EnableSQW - and the results look good on oscilloscope - tested for 0-3 amd all results look good... Note - I don't test the range passed for rate (so passing a value other than 0-3 will give 'unexpected' results - it would be asy to add .RateSelect = .RateSelect & 0b11 if you want to ...
by mnf
Tue Jun 30, 2020 4:05 pm
Forum: General Programming
Topic: Percentage
Replies: 4
Views: 108

Re: Percentage

You need to force use of FP numbers so "253.0 /255 * 100" should work. It's currently calculated as an integer then converted on assignment. (note the .0 does the magic)

Martin
by mnf
Mon Jun 29, 2020 10:53 pm
Forum: Flowcode V8
Topic: Arduino mega2560 problem with DS3132 RTC
Replies: 12
Views: 215

Re: Arduino mega2560 problem with DS3132 RTC

Can you post your code? I'm currently working on a new DS3231 component - which should also apply to DS3232 - I'll upload the latest version - which now supports SQW - here : https://www.matrixtsl.com/mmforums/viewtopic.php?f=80&t=22188 It's by no means complete yet - it's not a component yet, and I...
by mnf
Sun Jun 28, 2020 12:47 pm
Forum: User Components
Topic: DS3231 revisited
Replies: 4
Views: 99

Re: DS3231 revisited

The DS3231 doesn't quite do what I'd hoped - alarm when running on battery backup. I may have to look at something like the MCP7940n - which seems able to do it. (The SQW does work on battery on the ds3231/2) General layout and details of control are similar though and the current FC component seems...
by mnf
Sat Jun 27, 2020 6:39 pm
Forum: User Components
Topic: DS3231 revisited
Replies: 4
Views: 99

Re: DS3231 revisited

Not much interest... Still I made an alpha version. Seems to work well (with some provisos - alarms can be set, but not the sqw and 12h mode isn't really supported yet) It also isn't made into a component - so extraneous macros. On the plus side it works - demo main here sets a minute alarm on alarm...
by mnf
Wed Jun 24, 2020 11:16 pm
Forum: User Components
Topic: DS3231 revisited
Replies: 4
Views: 99

DS3231 revisited

I'm not usually in favour of re-inventing the wheel - but I noticed a comment about DS3231 alarms in the forum recently.. I alo wanted an interrupt using alarm 2 (hours and minutes match) - to wake a low power logger (so this can occur on the battery backup of the RTC and wake an ATTiny) (Note I use...
by mnf
Sun Jun 21, 2020 8:07 pm
Forum: Bug Reports
Topic: Unavailable port on compilation
Replies: 1
Views: 153

Unavailable port on compilation

I wrote a program using UART on an Arduino Nano. I then modified it to run on an ATTiny85 - I didn't delete the UART code - it was only referenced in a macro that was not used - and I had intended to go and modify this later - to get the data logged out without using USB comms (using a 'bare' 85) Co...
by mnf
Sat Jun 20, 2020 1:12 pm
Forum: Programming Tips & Tricks
Topic: Connecting 2 to 9 switches on one ADC pin
Replies: 12
Views: 620

Re: Connecting 2 to 9 switches on one ADC pin

Hi Martin, One query - there is some overlap in the checked values (<208 sw 1 >200 sw 2 for example)... This shouldn't pose a problem - button registered should map to first conditional statement... Unless you just use consecutive if's (and nested is going to get a bit messy for 9 switches) in which...
by mnf
Sat Jun 20, 2020 6:41 am
Forum: Programming Tips & Tricks
Topic: Connecting 2 to 9 switches on one ADC pin
Replies: 12
Views: 620

Re: Connecting 2 to 9 switches on one ADC pin

Thanks Martin,

An excellent resource - much neater than multiplexing the switches...

Martin
by mnf
Thu Jun 18, 2020 10:58 pm
Forum: Programming Tips & Tricks
Topic: Large memory for low pin count MCUs
Replies: 0
Views: 216

Large memory for low pin count MCUs

Having recently purchased and then written code to access 1MBit flash memory (also available as 2 and 4MBit chips) ( SST39SF010A) It struck me that that it might be 'fun' to have a large memory available to smaller MCUs with less pins.. I had some 24LC256 chips - so 4 would make a 1MBit memory (128K...
by mnf
Wed Jun 10, 2020 7:29 pm
Forum: Flowcode V5 Free Edition
Topic: eeprom
Replies: 7
Views: 200

Re: eeprom

Hi Samtim,

You just need to save a 16 bit number - so first byte as

Code: Select all

Value/256
(or Value >> 8 )and second byte as

Code: Select all

Value % 256
(Note for the second byte you can just use

Code: Select all

Value
as it will be 'truncated' to 8 bits or

Code: Select all

Value & 0xff
both of which are quicker than the modulus calculation..

Martin
by mnf
Wed Jun 03, 2020 9:18 am
Forum: Flowcode V8
Topic: Add new Component (SPI based EEPROM) ATMEL-AT25160AN-10
Replies: 2
Views: 127

Re: Add new Component (SPI based EEPROM) ATMEL-AT25160AN-10

Can you post your Flowcode so far?

If you would like to send me a sample of the chip in pdip format I would have a go - I have previously written a component for i2c memory chips...

Martin
by mnf
Sun May 31, 2020 12:35 pm
Forum: Flowcode V6
Topic: lcd_i2c component
Replies: 1
Views: 105

Re: lcd_i2c component

Unfortunately - the flowcode component has the address 'hardcoded' in - have a look at the C code (for example SendCommand). For example in the case of SSD1306(i2c) - 120.... The actual address is only used in a few places (SendCommand for example) - so these could be modified to use a variable rath...
by mnf
Tue May 26, 2020 1:48 pm
Forum: Flowcode V6
Topic: Inverting a Bool
Replies: 3
Views: 147

Re: Inverting a Bool

Yes, sorry my bad...

~ does give the expected results (0, 1) in the simulator if variable is of type bool..
But - it is a bitwise complement - so if the hardware is treating it as a byte (then it will be 0 - 255 or worse 1 - 254) on hardware...
So to avoid surprises use !


Martin
by mnf
Mon May 25, 2020 8:54 am
Forum: Flowcode V6
Topic: Inverting a Bool
Replies: 3
Views: 147

Re: Inverting a Bool

Try using ~ (tilde)

Code: Select all

a = ~a
Where a is of type bool.

Should work

Martin
by mnf
Fri May 08, 2020 6:57 pm
Forum: Flowcode V8
Topic: Help with MQTT Read
Replies: 3
Views: 693

Re: Help with MQTT Read

Re: Help with MQTT Read Postby mnf » Thu May 07, 2020 9:35 pm Hi James, welcome to the forums. Posting the same question again is frowned upon, however - (so I've deleted the copy) better to add another comment to the previous thread showing what you have tried and what has and hasn't worked.. Pleas...
by mnf
Wed May 06, 2020 7:21 pm
Forum: Bug Reports
Topic: Arduino Nano Analog pins
Replies: 0
Views: 432

Arduino Nano Analog pins

A minor inconvenience - the input icon doesn't allow AN7 (Port C7) to be selected for input.

Pins a6 and a7 can only be used as analog inputs (so sadly my idea of using them to power a i2c eeprom didn't work)
A6 (c6) is allowed in input and output - but will only work as an input..

Martin
by mnf
Wed May 06, 2020 12:30 pm
Forum: Flowcode V8
Topic: Two bytes to Integer without changing values
Replies: 5
Views: 354

Re: Two bytes to Integer without changing values

If space was at a premium then you could save the data as a bit stream - 7 bits would give you 0..127 and 4 bits 0..15. Seems like a lot of extra work however - why not just save one value per byte (use << 8 and >> 8 to access the upper byte of you need to convert to a 16 bit integer) - the SD routi...
by mnf
Sun May 03, 2020 8:49 pm
Forum: Flowcode V7
Topic: I2C master/slave help
Replies: 31
Views: 1640

Re: I2C master/slave help

Yes - some sites are less than friendly... Always seems a shame - everyone needs to learn something sometime.....


Martin