Hello and welcome!
P0340 is a camshaft position code. The ignition module uses the spark plugs to determine the cam position, so the first thing I would do is change the plugs. Be sure to use the NGK plugs that are specified for the car. These will give you the best performance in the long run. Other brand plugs just don't seem to work as well.
If that doesn't take care of it, you'll probably have to change the module itself.
Hope this helps! Write back if any of this isn't clear.
Thanks for checking in with us!
Not sure why taking a plug out and re-installing it would set this code, but if they haven't been changed for awile, I think I would start by doing that.
As far as the P1340 code, I don't have a listing for that. Was this also in the Engine control module, or maybe another module?
My recommendation at this point would be change the plugs, clear the codes, and drive it. See what, if anything, comes back.
Let me know what happens, I'll be here!
A little more info here-
The P0340 and P1340 codes are actually the same code as far as diagnostics. The difference being the first number after the "P". 0 indicates a generic code, which is what you would get if you scanned with a generic scan tool. 1 indicates a manufacturer specific code. It's really irrelevent in this case. Just a standard in the structure of the codes.
Just wanted to clear the issue up a bit!