Search found 1473 matches
- Tue Oct 10, 2023 2:44 pm
- Forum: Modules
- Topic: HPWM/HPWM2/HPWM3 hardware PWM modules
- Replies: 16
- Views: 81614
Re: HPWM/HPWM2/HPWM3 hardware PWM modules
Seems this is my screw up in generating the device files. For the 14-pin 18F0xQ40 and 18F0xQ41, you should change the device files. Find the line '#const _ports' and add '#const _no_portb'... #const _ports = 2 // 2 available ports #const _no_portb = 1 // no PORTB That should fix it. Changes apply to...
- Tue Oct 10, 2023 1:05 pm
- Forum: Modules
- Topic: HPWM/HPWM2/HPWM3 hardware PWM modules
- Replies: 16
- Views: 81614
Re: HPWM/HPWM2/HPWM3 hardware PWM modules
There seems to be an issue with the 14-pin versions of the Q40/Q41 and the 'IsValidPort()' check Those parts have no PORTB (just PORTA and PORTC), and that's causing the failure. HPWM.bas works ok with the 20-pin version 18F16Q41... it has ports A, B, and C For the time being you can comment out the...
- Fri Oct 06, 2023 1:56 pm
- Forum: Compiler
- Topic: finding the first bit set to '1'
- Replies: 0
- Views: 16723
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: 11047
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: 11047
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: 11047
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: 11047
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: 11047
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: 11047
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: 2991
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: 2991
Re: AddressOf command
Lee, check your PM's
- Wed Sep 13, 2023 12:46 pm
- Forum: Compiler
- Topic: AddressOf command
- Replies: 7
- Views: 2991
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: 11047
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: 2991
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: 1966
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...