First foray into PIC programming.

Started by digi2t, February 22, 2024, 02:19:45 PM

Previous topic - Next topic

digi2t

WARNING - NOOB CONTENT AHEAD!

Been using the CODA code for silent relay bypass builds for a while now, using my GX-4 programmer to program the 12F675's, but recently I thought about using CODA for a series dual effect build. I thought that it might be cool to use a 16F676 instead, rather than two 12F675's. Not only would it cut a bit of cost, but just makes better sense overall.

My question is; how difficult is it to mod the CODA code to get it to work in the 16F676, with two relays, two footswitches, and one optoisolator? Been doing quite a bit of reading on PIC coding, and I've been trying to rework the code in MPLAB, but I either get errors when it builds, or if I do get a successful build, it doesn't work on the breadboard.
  • SUPPORTER
Dead End FX
http://www.deadendfx.com/

Asian Icemen rise again...
http://www.soundclick.com/bands/default.cfm?bandID=903467

"My ears don't distinguish good from great.  It's a blessing, really." EBK

ElectricDruid

In the grand scheme of things it would fall into the "not very hard" category. Of course, when you're flailing about not even knowing what the error messages mean or what the problem that they're trying to tell you about could be, that's not much help. *Everything* is hard until you understand it!

In general, to move code from one PIC to another, you'd need to make sure you were using the right header files, make sure that the new chip had the same peripherals as the old one, and named things similarly (they *mostly* do, but there are variations, so it's sensible not to take anything for granted). Once the actual hardware setup is sorted out, getting actual C code moved from one chip to another is fairly painless.

My recommendation would be to hit a specific issue, get stuck, and post it here, and we'll help if we can. Then you move onto the next one! That's debugging for you. One day they're all dealt with and it suddenly starts working!*


* I have heard this can happen.



digi2t

Tom, you make an excellent point! I think I dove into the deep end too quickly.

What I should do to start is simply move the code over to the 676, adjust the code and IO's accordingly, and see where that leads me.

Thanks for opening a window. I'll post back with results.
  • SUPPORTER
Dead End FX
http://www.deadendfx.com/

Asian Icemen rise again...
http://www.soundclick.com/bands/default.cfm?bandID=903467

"My ears don't distinguish good from great.  It's a blessing, really." EBK

namagama37

#3
Modifying CODA code to work with 16F676 instead of two 12F675 can be challenging but is feasible with sufficient understanding of PIC coding and the circuitry involved. Here are some steps you can consider:

Understand the difference: Get familiar with the datasheets of both PIC microcontrollers (12F675 and 16F676) to understand their pin configurations, features, and instruction sets. Identify any differences that may affect your code.

Pin mapping: Make sure that the pin assignments in your code match the physical connections on the 16F676. You may need to adjust the pin assignments for the relays, footswitches, and opto-isolators accordingly.

Configuration settings: Test and adjust configuration settings in your code to match 16F676 requirements, including oscillator settings, watchdog timers, and more.

Port configuration: Configure I/O ports correctly for input and output operations. Make sure that the ports connecting the relays, footswitches, and opto-isolators are configured properly.

Interrupt handling: If your code relies on interrupts, make sure they are set up correctly for 16F676.

Test and debug: After making changes, thoroughly test your code on the circuit board. Use the debugging tools available in MPLAB to identify any errors or problems in your code. Debugging may involve monitoring the state of pins, registers, and variables at runtime.

Iterative development: You may need to repeat your code many times for it to work correctly. Make small, incremental changes and test them thoroughly before moving forward.

Community support: Use forums, communities, or online resources specific to PIC programming for guidance and support if you encounter specific challenges or errors during the modding process.

By following these steps and applying a systematic approach, you can increase your chances of successfully modifying the CODA code to work with 16F676 for your series dual effect build.

Ksander

#4
You sound like chatGTP  ;D

Actually... that's how I sometimes approach projects now. I just bounce ideas off of the ol' AI, and keep doing so until I get something useful, or I give up and ask people. It doesn't know datasheets, but it can help review code.

duck_arse

Quote from: Ksander on February 24, 2024, 01:01:01 AMYou sound like chatGTP  ;D

Actually... that's how I sometimes approach projects now. I just bounce ideas off of the ol' AI, and keep doing so until I get something useful, or I give up and ask people. It doesn't know datasheets, but it can help review code.

interesting. I thort it passed the human test, but when I reread it, it does sound like boring drivel. the usual method [seen hereabouts] is to qoute and/or paraphrase a post from earlier in the thread, sometimes from off-site. some here have the knack of finding, or somehow just knowing, the off-site originals.

and so far, the poster has not payloaded the post. but we keep watching, waiting.
" I will say no more "

Ksander

Quote from: duck_arse on February 24, 2024, 08:22:29 AMinteresting. I thort it passed the human test, but when I reread it, it does sound like boring drivel. the usual method [seen hereabouts] is to qoute and/or paraphrase a post from earlier in the thread, sometimes from off-site. some here have the knack of finding, or somehow just knowing, the off-site originals.

and so far, the poster has not payloaded the post. but we keep watching, waiting.

You mean I should have quoted namagama37? I guess. The give-away for me was the structuring: general opening; bullet point list of actions; general closing. It is always the same. There could've been a closing line like: "Remember, while X can be a rewarding endeavour, it is important not to stick your peepee in the power socket and to be inclusive of all peoples" 

duck_arse

the post reads as the usual drivel that a1 generates. the source text fed into the a1, however, doesn't come from this page - unless - unless they've learned ........

it might come to pass that this last few posts disappear at some point, depending on the member's next move. if any.
" I will say no more "

bluebunny

Interesting that this alleged AI came back and edited their post.  BTW, they also had a dodgy website in their profile (removed).

Anyway, back to your thread Dino.  :)
  • SUPPORTER
Ohm's Law - much like Coles Law, but with less cabbage...

ElectricDruid

Quote from: duck_arse on February 24, 2024, 09:12:09 AMthe post reads as the usual drivel that a1 generates.

+1 agree. Smells of AI to me, which is to say artificial and not very intelligent. Like Ksander said, it'S got that format - standard opening, list of items, close. Even the sentences all sound the same. There might come a time when AIs know far more than we do, but the people will *still* be much more interesting to talk to!

moosapotamus

Quote from: Ksander on February 24, 2024, 08:32:45 AM... it is important not to stick your peepee in the power socket and to be inclusive of all peoples" 
That is sig-worthy, bro!  8)
moosapotamus.net
"I tend to like anything that I think sounds good."

digi2t

Quote from: bluebunny on February 24, 2024, 10:17:19 AMAnyway, back to your thread Dino.  :)

Thanks Marc!

Sorry to disappoint folks, but if I had any AI at my disposal, I may have maybe solved my problem without setting off any alarms here.

What have we become? :icon_sad:

Back to my PIC hole I go....
  • SUPPORTER
Dead End FX
http://www.deadendfx.com/

Asian Icemen rise again...
http://www.soundclick.com/bands/default.cfm?bandID=903467

"My ears don't distinguish good from great.  It's a blessing, really." EBK

ElectricDruid

We were talking about namagama37, not you Dino. We *know* you're human!

Good luck down the PIC hole.