Search found 1237 matches

by Jerry Messina
Wed Apr 21, 2021 1:02 pm
Forum: Modules
Topic: I2C SCANNER
Replies: 13
Views: 658

Re: I2C SCANNER

I had done the same thing and the compiler said error... The compiler hates me because of all the sloppy & incorrect code that I feed it.... But I would choose it again over the others! Here's a tip - when you get compilation errors they're listed in the results window "last to first". Scroll down ...
by Jerry Messina
Wed Apr 21, 2021 12:46 pm
Forum: Modules
Topic: I2C SCANNER
Replies: 13
Views: 658

Re: I2C SCANNER

IS Z = Z >> 3 VALID Yes, it's valid. The following compiles fine for me: dim Z as byte Z = Z >> 3 Maybe there was something else it was really complaining about? DO #option DIGITALIO_INIT = true AND SetAllDigital() ACCOMPLISH THE SAME RESULT? If you look at the last page of the library file SetDigi...
by Jerry Messina
Tue Apr 20, 2021 10:50 am
Forum: Modules
Topic: I2C SCANNER
Replies: 13
Views: 658

Re: I2C SCANNER

For the left-shift (<<) and right-shift (>>) operators, the syntax is: variable_to_shift SHIFT_OP number_of_times_to_shift For example: A = B >> 1 means : shift 'B' right 1 time and assign the result to 'A' The variable 'B' itself is not modified as a result of doing the shift. If you use it as a pa...
by Jerry Messina
Tue Apr 20, 2021 12:02 am
Forum: Modules
Topic: I2C SCANNER
Replies: 13
Views: 658

Re: I2C SCANNER

That's what I get for not trying something before posting it. The for loop For addr = 128 To 254 Step 2 won't work very well since 'addr' is a byte. On the last loop it'll try to increment it: addr = 254 + 2 = 256, which gets truncated to 0 since it's a byte I think the best/clearest code is probabl...
by Jerry Messina
Mon Apr 19, 2021 11:04 pm
Forum: Modules
Topic: I2C SCANNER
Replies: 13
Views: 658

Re: I2C SCANNER

The INA219 may be ok... once you change the loop to scan more addresses you should see it show up at 0 and $80 (128).
We weren't scanning far enough at first to see it in both places.
by Jerry Messina
Mon Apr 19, 2021 1:46 pm
Forum: Modules
Topic: I2C SCANNER
Replies: 13
Views: 658

Re: I2C SCANNER

I just noticed this. If you want to scan the entire address range, the 'for' loop needs to be: for addr = 0 to 127 if (I2C2.IsPresent(addr<<1)) then // device found else // not found endif That scans all even address bytes from 0 to 254 ($FE), which covers the 7-bit addresses 0 to 127. Stopping at 1...
by Jerry Messina
Mon Apr 19, 2021 12:30 pm
Forum: Modules
Topic: I2C SCANNER
Replies: 13
Views: 658

Re: I2C SCANNER

Let's start with the basics... - you do have pull up resistors on SCL and SDA, correct? (10K or less) - I'm sure you just added it later, but you don't need your 'addrs' variable - the I2C module uses full 8-bit addresses, so they always include the R/W bit If the 24LC02 is the only device on the bu...
by Jerry Messina
Wed Apr 07, 2021 12:19 pm
Forum: Modules
Topic: i2c Does not want to show what's on the bus?
Replies: 5
Views: 369

Re: i2c Does not want to show what's on the bus?

It's not really a bug in the original code... it all depends on which device you use. Newer chips tend to have a lot more analog pins, so the risk of running afoul is greater now. I'd change the default to switch them all to digital, but that would break a lot of existing code. Plus, the chip poweri...
by Jerry Messina
Tue Apr 06, 2021 10:40 am
Forum: Modules
Topic: i2c Does not want to show what's on the bus?
Replies: 5
Views: 369

Re: i2c Does not want to show what's on the bus?

No, you didn't do anything stupid. What that example is missing is the IO pin setup to switch pins to digital mode. Many of the IO pins default to analog mode at startup, and if they're in analog mode they always read '0'. For I2C that would look like an ACK. Add this to your '// import libraries' s...
by Jerry Messina
Sun Mar 14, 2021 2:14 pm
Forum: Modules
Topic: SOFTWARE UART - ASM ERRORS
Replies: 9
Views: 453

Re: SOFTWARE UART - ASM ERRORS

Glad you got it figured out. If you try the FDX module (hwsuart_FD.bas), you'll have to use something other than an 18F14K22. Full-duplex uses two independent TMRx and CCPx peripherals, one for TX and another for RX, and while the 14K22 has two TMR modules (TMR1/TMR3), it only has a single CCP1 peri...
by Jerry Messina
Sat Mar 13, 2021 12:42 pm
Forum: Modules
Topic: SOFTWARE UART - ASM ERRORS
Replies: 9
Views: 453

Re: SOFTWARE UART - ASM ERRORS

Lee - Could you post all of the actual code you're using? What you posted doesn't compile as is. Also, just so you know - in general, software UARTs are usually ok for sending data but have multiple issues reading data. Since there's no hardware involved, your code must be ready to receive a byte (i...
by Jerry Messina
Mon Mar 01, 2021 4:39 am
Forum: General
Topic: interested in new device support?
Replies: 12
Views: 1354

Re: interested in new device support?

Datasheets now rival War And Peace.

I'm not looking for anything specific, just how things go as you try various functions.
The new devices have some very different layouts.
by Jerry Messina
Tue Feb 23, 2021 1:59 pm
Forum: Compiler
Topic: Vector Interrupts
Replies: 8
Views: 1737

Re: Vector Interrupts

Well, almost a year later and I finally got around to doing an article on using vectored interrupts!

The new IVT V2.0 module in the latest update makes this much easier to setup.
There are also a few more examples and even versions of ISRRX and ISRTimer that support using them.
by Jerry Messina
Mon Feb 22, 2021 8:09 pm
Forum: Wiki Announcements
Topic: New Article: Using Vectored Interrupts with Swordfish
Replies: 1
Views: 9101

New Article: Using Vectored Interrupts with Swordfish

There's a new article describing how to use Vectored Interrupts with SF and the IVT.bas module.

This goes along with the IVT V2.0 module in the latest library update.
by Jerry Messina
Mon Feb 22, 2021 8:03 pm
Forum: Announcements
Topic: Swordfish Library and Device File Update 2_22_2021
Replies: 0
Views: 649

Swordfish Library and Device File Update 2_22_2021

Swordfish Library and Device File Update 2_22_2021 This update for V2.2.3.6 has various device file and library updates, including: K83 device file updates to fix interrupt definitions updated IVT module for improved vectored interrupt support (IVT.bas V2.0) versions of ISRRX and ISRTimer for vector...