Search found 1471 matches
- Fri Oct 06, 2023 1:56 pm
- Forum: Compiler
- Topic: finding the first bit set to '1'
- Replies: 0
- Views: 15290
finding the first bit set to '1'
I ran across this code and thought it was a neat trick, so I adapted it to SF. It locates the first bit in a byte that's set to a '1' // // find lowest bit set in a byte // returns bitmask indicating the first set bit, or 0 if none are set // function FindLowestBit(b as byte) as byte // this functio...
- Sun Oct 01, 2023 3:01 pm
- Forum: Modules
- Topic: Suart module with parity bit
- Replies: 12
- Views: 10573
Re: Suart module with parity bit
Try this version of suart_parity.bas (it should clear up the "EWWO" issue) I changed the attributes of the parity functions to use 'access', which appears to be required since they're called from functions with that attribute. Without that it was overlaying variables. I wasn't aware of that since 'a...
- Sun Oct 01, 2023 1:09 pm
- Forum: Modules
- Topic: Suart module with parity bit
- Replies: 12
- Views: 10573
Re: Suart module with parity bit
Well this is sort of embarrassing... I send the string EVEN 8,1 and I receive EWWO 8,1 So, I just tried to transmit the string "EVEN 8,1" and I got exactly what you did... "EVEN" became "EWWO". uart.write("EVEN 8,1") It works ok when you compile for N81 (#option SUART_PARITY = 0), so it's something ...
- Sat Sep 30, 2023 6:40 pm
- Forum: Modules
- Topic: Suart module with parity bit
- Replies: 12
- Views: 10573
Re: Suart module with parity bit
It should work OK for transmitting... that part's easier. I don't think you'll see anything different using teraterm since it's a hardware function. Are you allowing time at startup for the osc to stabilize? If the first few chars are bad and then it gets better that could be the issue. Do you have ...
- Sat Sep 30, 2023 2:44 pm
- Forum: Modules
- Topic: Suart module with parity bit
- Replies: 12
- Views: 10573
Re: Suart module with parity bit
I had a chance to test suart_parity.bas on some real hdw and it worked ok for me. I used an 18F26K22 at 16MHz (close enough to the K20) , and tried baudrates from 9600-38400 with no parity, even, and odd settings. The test program I used is below. The problem you're having may be due to the way a so...
- Tue Sep 26, 2023 5:26 pm
- Forum: Modules
- Topic: Suart module with parity bit
- Replies: 12
- Views: 10573
Re: Suart module with parity bit
I guess I'll have to actually try it and see what's going on.
What clock are you using for the K20?
Also, when you say you sent that string, you do mean you sent it from the pic to your external device, right?
I'm not going to be able to get to it until the weekend though.
What clock are you using for the K20?
Also, when you say you sent that string, you do mean you sent it from the pic to your external device, right?
I'm not going to be able to get to it until the weekend though.
- Sat Sep 16, 2023 1:22 pm
- Forum: Modules
- Topic: Suart module with parity bit
- Replies: 12
- Views: 10573
Re: Suart module with parity bit
Here's a copy of suart.bas that I modified to add parity. It'll do 8N1, 8O1, or 8E1, which you set using '#option SUART_PARITY' // SUART_PARITY options: 0=none (8N1), 1=odd (8O1), 2=even (8E1) #option SUART_PARITY =2 include "suart_parity.bas" This should compute the parity and add the ninth-bit to ...
- Sat Sep 16, 2023 1:09 pm
- Forum: Compiler
- Topic: AddressOf command
- Replies: 7
- Views: 2545
Re: AddressOf command
Close, but not quite. When you have this: type TEvent = event() you're declaring a new user type called 'TEvent', and that type is a pointer to an event() routine. When you define an instance of that type you create a variable, and the variable can hold the address of an event() procedure which you ...
- Fri Sep 15, 2023 7:28 pm
- Forum: Compiler
- Topic: AddressOf command
- Replies: 7
- Views: 2545
Re: AddressOf command
Lee, check your PM's
- Wed Sep 13, 2023 12:46 pm
- Forum: Compiler
- Topic: AddressOf command
- Replies: 7
- Views: 2545
Re: AddressOf command
What happens if they don't call a sub? Does it work ok?
Does it matter if they don't call the Speak_data sub?
I'll need more details to see what's going on, but I'm not really going to be available much for the next few days.
Does it matter if they don't call the Speak_data sub?
I'll need more details to see what's going on, but I'm not really going to be available much for the next few days.
- Wed Sep 13, 2023 11:56 am
- Forum: Modules
- Topic: Suart module with parity bit
- Replies: 12
- Views: 10573
Re: Suart module with parity bit
I've tried unsuccessfully to modify the suart.bas module adding the 9 parity bit Could you show what you tried? Which pic are you using? Does it have to be a software uart? Some of the newer devices like the Q43 have hw parity support builtin, but pretty much any of the hardware uarts can be setup ...
- Tue Sep 12, 2023 1:39 pm
- Forum: Compiler
- Topic: AddressOf command
- Replies: 7
- Views: 2545
Re: AddressOf command
Calling routines from asm code "hides" the routine from the compiler. In any case, there's no such thing as an indirect asm CALL instruction, so the following doesn't do what you think it does dim tempaddr as word tempaddr = addressof(c_sensor) asm call tempaddr end asm An asm CALL translates to a 2...
- Sun Sep 10, 2023 12:15 pm
- Forum: Modules
- Topic: I2C-24LC256 intermittent read error
- Replies: 2
- Views: 1504
Re: I2C-24LC256 intermittent read error
Another way to do that using the overloaded ReadByte(pAck as bit) routine is to loop reading all but the last byte, and then handle the last byte outside the loop... // loop reading all but the last byte For Page_counter = 0 To 254 Model_system_data(Page_counter) = I2C.ReadByte(I2C_ACKNOWLEDGE) Next...
- Fri Sep 08, 2023 11:45 am
- Forum: Modules
- Topic: LCD module Custom Characters
- Replies: 2
- Views: 1455
Re: LCD module Custom Characters
With the HD44780 you get 8 custom chars. These chars are displayed when you write character codes 0-7 to the display (DDRAM data), just like you would write ascii text ('1', '2', etc). Each custom char pattern takes eight bytes of CGRAM data (the dot patterns). Once you load the CGRAM data with the ...
- Sat Sep 02, 2023 10:21 pm
- Forum: User Modules
- Topic: SD Card Read position
- Replies: 5
- Views: 2302
Re: SD Card Read position
I noticed in the comments that you have to use OpenFileRW() instead of OpenFile() if you want to use FSeek().
I haven't tested that... if you run across anything odd let me know.
I haven't tested that... if you run across anything odd let me know.