CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

manchester decode
Goto page Previous  1, 2, 3 ... , 18, 19, 20  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
PrinceNai



Joined: 31 Oct 2016
Posts: 527
Location: Montenegro

View user's profile Send private message

PostPosted: Thu Feb 13, 2025 7:04 am     Reply with quote

Another small suggestion:

#define PREAMBLE_MIN_TIME 7 * TE //6

If the preamble is 7*TE long, don't go so narrow. The point here is simply to always miss the synch bits. 6.5, 6.8, ok. There will come a hot day and suddenly it won't work any more because you'll miss the preamble for two counts. And another batch of hair will be gone for good :-)


Last edited by PrinceNai on Thu Feb 13, 2025 8:36 am; edited 1 time in total
bulut_01



Joined: 24 Feb 2024
Posts: 206

View user's profile Send private message

PostPosted: Thu Feb 13, 2025 7:30 am     Reply with quote

OKEY thanks Cool
temtronic



Joined: 01 Jul 2010
Posts: 9425
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Thu Feb 13, 2025 10:30 am     Reply with quote

Also always better to use a crystal and caps instead of the internal oscillator if you need accurate,precise timing.
This is kinda important in most(all) serial communications and 'extremes' in temperature, hot or cold.
bulut_01



Joined: 24 Feb 2024
Posts: 206

View user's profile Send private message

PostPosted: Thu Feb 13, 2025 10:32 am     Reply with quote

I trust pic mcu in this regard, it will not let you down. Cool
bulut_01



Joined: 24 Feb 2024
Posts: 206

View user's profile Send private message

PostPosted: Sat Feb 22, 2025 6:51 am     Reply with quote

@princenai I have a question that bothers me. This manchester decode code works in ext_ interrupt. Why doesn't it work in IOC_ interrupt?
temtronic



Joined: 01 Jul 2010
Posts: 9425
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sat Feb 22, 2025 7:44 am     Reply with quote

Perhaps you've not setup the IOC registers correctly ?
bulut_01



Joined: 24 Feb 2024
Posts: 206

View user's profile Send private message

PostPosted: Sat Feb 22, 2025 9:01 am     Reply with quote

I set it up. But is there a speed difference between IOC and EXT interrupts?
temtronic



Joined: 01 Jul 2010
Posts: 9425
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sat Feb 22, 2025 10:17 am     Reply with quote

According to the datasheet, page 369,table-30-4, test OS20, OS21...... no.

Both have minimum spec of 25ns
However they are NOT 'tested, carved in stone' numbers

pretty sure knowing what you're using the PIC for they are not 'different'.
So as to why it doesn't work, leads me to believe you've not setup IOC the same as EXT_INT is setup.
bulut_01



Joined: 24 Feb 2024
Posts: 206

View user's profile Send private message

PostPosted: Sat Feb 22, 2025 10:59 am     Reply with quote

Maybe it's an area I overlooked. When I tested the IOC interrupt, it works. But when I use Manchester decode, things change.
temtronic



Joined: 01 Jul 2010
Posts: 9425
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sat Feb 22, 2025 4:08 pm     Reply with quote

Post your setup code for both versions......
PrinceNai



Joined: 31 Oct 2016
Posts: 527
Location: Montenegro

View user's profile Send private message

PostPosted: Sat Feb 22, 2025 6:05 pm     Reply with quote

Quote:
Post your setup code for both versions......


Yes. With external interrupt the direction of change is set manually in code according to what you are looking for in any particular state. The way it was done will not work directly with IOC. As Mr. T said, maybe your setup of IOC pin isn't correct, meaning that something else changes on other pins and interrupt fires because of that.

As a start, I'd loose all parts of the code that deal with the direction of change (it won't affect IOC anyway, but code will be easier to read) and add a test in the first state to check if it was a 0 to 1 transition before proceeding to second state. Everything depends on that. If the first interrupt happens on a 1-0 transition nothing will work. Simple, close complete first state except break; in
if(input_state(pin_A1) == 1){

}
If yes, go to second state, if not, exit and wait for next interrupt.

Time it takes to reach interrupt shouldn't be a problem, signals are more than long enough to allow for anything. I mean, 640us. Time for a coffee at those instruction cycle speeds.
bulut_01



Joined: 24 Feb 2024
Posts: 206

View user's profile Send private message

PostPosted: Sat Feb 22, 2025 6:39 pm     Reply with quote

Thanks for your answers. I'll test your suggestions when I find time.
bulut_01



Joined: 24 Feb 2024
Posts: 206

View user's profile Send private message

PostPosted: Sun Feb 23, 2025 7:27 am     Reply with quote

I made an edit for the IOC interrupt, it doesn't work that way.(note ioc interrupt is working)

Last edited by bulut_01 on Mon Feb 24, 2025 1:47 pm; edited 1 time in total
bulut_01



Joined: 24 Feb 2024
Posts: 206

View user's profile Send private message

PostPosted: Mon Feb 24, 2025 2:15 am     Reply with quote

@princenai Why is the above code not working with ioc interrupt?
temtronic



Joined: 01 Jul 2010
Posts: 9425
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Feb 24, 2025 8:08 am     Reply with quote

One possible reason, though I can't test...
is that 1st line of the IOC handler you clear the interrupt.
that should allow more interrupts to happen within the handler, which could be bad

My understanding is that the compiler clears the interrupt when the handler is completed......
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2, 3 ... , 18, 19, 20  Next
Page 19 of 20

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group