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

Modbus & ticker
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
greenbridge



Joined: 14 May 2018
Posts: 19

View user's profile Send private message Send e-mail

PostPosted: Wed Mar 17, 2021 2:32 am     Reply with quote

The thing is that the unit is used in potentially "noisy" environment. I hope to fix the problem by replacing the current PIC with the one with dedicated data eeprom (like PIC16F17xx).
Ttelmah



Joined: 11 Mar 2010
Posts: 19529

View user's profile Send private message

PostPosted: Wed Mar 17, 2021 3:36 am     Reply with quote

That massively 'reduces' the chance of problems, but still leaves a small
part of the issue there.
Reduces, since there will no longer be code needed to write to the
program memory. Not having this means the program memory should
not change. Hurrah.
However 'part still there', since the current problem seems to imply that
the chip is getting it's RAM contents corrupted. This may well result in
slightly 'wrong' things happening in the code.
Now, I have PIC's in some very 'noisy' environments, and with really careful
PCB designs, they give no issues at all. Steps:
1) Well smoothed initial supply.
2) Good ground plane under the chip.
3) Protection on every input and output. Every signal coming onto the board
has input resistors and clamp diodes, or opto coupling. Same for every
output signal.
4) Careful layout of signal paths. Anything carrying significant power or
potentially carrying noisy signals routes well away from PIC signals, and
also the ground paths for such signals do not cross the board where
the processor components actually are.
5) Supply layout isolation. The parts feeding the ADC etc., have their own
extra smoothing.
6) Decoupling, decoupling, decoupling. Some things like SD cards for
example, need very good low ESR capacitors close to the device, and
values much larger than the 0.1uF.
7) Shielding. If there is a lot of radiated EMF, then a grounded metal casing
may well be needed. Good old Faraday...
temtronic



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

View user's profile Send private message

PostPosted: Wed Mar 17, 2021 4:42 am     Reply with quote

Mr. T's 'seven steps to success' does WORK !
In my former job, back in '77 I did design/build of Optical Emission Spectrometer computer systems.The rack containing an LSI-11 system and my 32 channel ADC subsystem were INSIDE the spectrometer. EMI, RF ? Think of 20KV and 200-350ma for 1-2 minutes..........
I did all '7' and then some and could reliably get 15 bits of a 16 bit ADC, almost all of the time. It's all about details and doing everything possible to eliminate any way EMI/RF/'noise' can get into your system.

Years later...one rather nasty, repeatable 'event' always occurred between 1 and 2 AM on a Sunday night, putting 'noise' on my remote energy control system (used Bell telephone wiring....). After 2 months of head scratching it was traced to bad Bell wires causing 'crosstalk'. Had them reroute my wires in another cable span..... problem solved....

Sometimes you have to think 'outside the box' and try things that 'this will never work' and magically the problem is solved.

Jay
greenbridge



Joined: 14 May 2018
Posts: 19

View user's profile Send private message Send e-mail

PostPosted: Wed Mar 17, 2021 6:59 am     Reply with quote

Thanks a bunch Very Happy
Killink



Joined: 28 Aug 2023
Posts: 1

View user's profile Send private message

PostPosted: Wed Aug 30, 2023 11:11 am     Reply with quote

Quote:
Just change 'TICKS_PER_SECOND' in the ticker code to 'TICK_TICKS_PER_SECOND'. Where it is defined and where it is used. A total of a couple of locations.


Sorry to hijack the thread and for the rookie question, but how do I change the ticker code? I am encountering the same issue.
Do I just modify tick.c and tick.h in the drivers folder? I dont see either of tick.c or tick.h called from any of the modbus libraries or where TICKS_PER_SECOND gets defined which is why I am a little confused.

Lines of code generating the duplicate define compiler warning:
#USE TIMER(TIMER=1,TICK=.1ms,BITS=16, ISR, STREAM=TIM1)
#USE TIMER(TIMER=2,TICK=.1ms,BITS=16, ISR, STREAM=TIM2)

I am using the PIC18F87K22 and according to the data sheet I have plenty of 16 bit timers.
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
Page 2 of 2

 
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